summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Small <csmall@enc.com.au>2013-10-09 19:18:55 +1100
committerCraig Small <csmall@enc.com.au>2013-10-09 19:18:55 +1100
commit422a4a5e6756c8e7864318ce72a9dd85ae083bf8 (patch)
tree9f62db3c1c14e6c27926f7f839e1b543fff2110b
parente6a78f2745ca6c7ceed4406d3ce5397e77518b11 (diff)
downloadprocps-ng-422a4a5e6756c8e7864318ce72a9dd85ae083bf8.tar.gz
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
-rw-r--r--testsuite/pgrep.test/pgrep.exp20
-rw-r--r--testsuite/pkill.test/pkill.exp18
2 files changed, 25 insertions, 13 deletions
diff --git a/testsuite/pgrep.test/pgrep.exp b/testsuite/pgrep.test/pgrep.exp
index 0cb6db7..248c45f 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 9e0b7e2..2c9f91e 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