From: Craig Small Date: Wed, 9 Oct 2013 08:18:55 +0000 (+1100) Subject: Skip some tests if kill cannot be found X-Git-Tag: v3.3.9~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=422a4a5e6756c8e7864318ce72a9dd85ae083bf8;p=procps-ng Skip some tests if kill cannot be found Some Debian pbuilders error out on some of the tests because they cannot find kill to kill the test processes. Now if we cannot find kill we skip those lot of tests. Still need to work out why the S390 doesn't like test_sched References: http://bugs.debian.org/725743 --- diff --git a/testsuite/pgrep.test/pgrep.exp b/testsuite/pgrep.test/pgrep.exp index 0cb6db78..248c45fb 100644 --- a/testsuite/pgrep.test/pgrep.exp +++ b/testsuite/pgrep.test/pgrep.exp @@ -12,16 +12,22 @@ set ps "${topdir}ps/pscommand" set raw_tty [ exec tty ] regexp "/dev/(.+)" $raw_tty > tty +set test "pgprep with no arguments" +spawn $pgrep +expect_pass "$test" "^\(lt-\)\?pgrep: no matching criteria specified\\s*" + +# Tests that don't need the test process go above here +if { [ catch { exec sh -c "command -v kill" } kill_path] } { + untested { kill path not found } + return +} + make_testproc set testproc_len [ string length $testproc_comm ] set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } ] ] set testproc1_sid [ string trim [ exec $ps --no-headers -o sid $testproc1_pid ] ] -set test "pgprep with no arguments" -spawn $pgrep -expect_pass "$test" "^\(lt-\)\?pgrep: no matching criteria specified\\s*" - set test "pgrep find both test pids" spawn $pgrep $testproc_comm expect_pass "$test" "^$testproc1_pid\\s+$testproc2_pid\\s*$" @@ -117,6 +123,6 @@ expect_blank $test # Cleanup -exec kill $testproc1_pid -exec kill $testproc2_pid -exec rm $testproc_path +eval exec "$kill_path $testproc1_pid" +eval exec "$kill_path $testproc2_pid" +file delete $testproc_path diff --git a/testsuite/pkill.test/pkill.exp b/testsuite/pkill.test/pkill.exp index 9e0b7e27..2c9f91e6 100644 --- a/testsuite/pkill.test/pkill.exp +++ b/testsuite/pkill.test/pkill.exp @@ -12,15 +12,21 @@ set ps "${topdir}ps/pscommand" set raw_tty [ exec tty ] regexp "/dev/(.+)" $raw_tty > tty +set test "pkill with no arguments" +spawn $pkill +expect_pass "$test" "^\(lt-\)\?pkill: no matching criteria specified\\s*" + +# Tests that don't need the test process go above here +if { [ catch { exec sh -c "command -v kill" } kill_path] } { + untested { kill path not found } + return +} + make_testproc set testproc_len [ string length $testproc_comm ] set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } ] ] set testproc1_sid [ exec $ps --no-headers -o sid $testproc1_pid ] -set test "pkill with no arguments" -spawn $pkill -expect_pass "$test" "^\(lt-\)\?pkill: no matching criteria specified\\s*" - set test "pkill find both test pids" spawn $pkill -0 -e $testproc_comm expect_pass "$test" "^$testproc_comm killed \\(pid $testproc1_pid\\)\\s+$testproc_comm killed \\(pid $testproc2_pid\\)\\s*$" @@ -126,6 +132,6 @@ untested "$test" # Cleanup -exec kill $testproc1_pid -exec kill $testproc2_pid +eval exec "$kill_path $testproc1_pid" +eval exec "$kill_path $testproc2_pid" exec rm $testproc_path