procps/testsuite/pwait.test/pwait.exp
Craig Small 2c7b575099 build-sys: Make pwait test dependent on pwait built
As pwait building is conditional, testsuite should
only run pwait tests if there is a pwait binary.
2020-12-22 15:20:30 +11:00

45 lines
1009 B
Plaintext

#
# Dejagnu tests for pwait - part of procps
#
set mypid [pid]
set not_ppid [ expr { $mypid + 1 } ]
set pwait "${topdir}pwait"
set uid [ exec id -u ]
set not_uid [ expr { $uid + 1 } ]
set gid [ exec id -g ]
set not_gid [ expr { $gid + 1 } ]
if { ![ file exists $pwait ] } {
untested { skipping (not build)}
return
}
set test "pwait with no arguments"
spawn $pwait
expect_pass "$test" "^\(lt-\)\?pwait: no matching criteria specified\\s*"
make_testproc
set test "pwait with not matching gid"
spawn $pwait -G $not_gid $testproc_comm
expect_blank $test
set test "pwait doesn't match with bogus parent pid"
spawn $pwait -P $not_ppid $testproc_comm
expect_blank "$test"
set test "pwait doesn't match with bogus sid"
spawn $pwait -s -1 $testproc_comm
expect_blank "$test"
set test "pwait doesn't match with bogus tty"
spawn $pwait -t glass $testproc_comm
expect_blank "$test"
set test "pwait with not matching uid"
spawn $pwait -U $not_uid $testproc_comm
expect_blank $test
# Cleanup
kill_testproc