From 4825797d972cf4ccb1dd35fcefbf539135e5dfea Mon Sep 17 00:00:00 2001 From: Craig Small Date: Tue, 22 Dec 2020 12:25:44 +1100 Subject: [PATCH] testsuite: Add pwait tests They're pretty simple tests but its something. References: commit 09327c2b772fd7bc2762c557855e6a78b6352eb5 --- testsuite/pwait.test/pwait.exp | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 testsuite/pwait.test/pwait.exp diff --git a/testsuite/pwait.test/pwait.exp b/testsuite/pwait.test/pwait.exp new file mode 100644 index 00000000..867f0ff5 --- /dev/null +++ b/testsuite/pwait.test/pwait.exp @@ -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