testsuite: Add pwait tests

They're pretty simple tests but its something.

References:
  commit 09327c2b77
This commit is contained in:
Craig Small 2020-12-22 12:25:44 +11:00
parent 980983db74
commit 4a54ae97a0

View File

@ -0,0 +1,39 @@
#
# 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 } ]
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