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
This commit is contained in:
Craig Small 2013-10-09 19:18:55 +11:00
parent e6a78f2745
commit 422a4a5e67
2 changed files with 25 additions and 13 deletions

View File

@ -12,16 +12,22 @@ set ps "${topdir}ps/pscommand"
set raw_tty [ exec tty ] set raw_tty [ exec tty ]
regexp "/dev/(.+)" $raw_tty > 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 make_testproc
set testproc_len [ string length $testproc_comm ] set testproc_len [ string length $testproc_comm ]
set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } ] ] 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 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" set test "pgrep find both test pids"
spawn $pgrep $testproc_comm spawn $pgrep $testproc_comm
expect_pass "$test" "^$testproc1_pid\\s+$testproc2_pid\\s*$" expect_pass "$test" "^$testproc1_pid\\s+$testproc2_pid\\s*$"
@ -117,6 +123,6 @@ expect_blank $test
# Cleanup # Cleanup
exec kill $testproc1_pid eval exec "$kill_path $testproc1_pid"
exec kill $testproc2_pid eval exec "$kill_path $testproc2_pid"
exec rm $testproc_path file delete $testproc_path

View File

@ -12,15 +12,21 @@ set ps "${topdir}ps/pscommand"
set raw_tty [ exec tty ] set raw_tty [ exec tty ]
regexp "/dev/(.+)" $raw_tty > 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 make_testproc
set testproc_len [ string length $testproc_comm ] set testproc_len [ string length $testproc_comm ]
set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } ] ] set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } ] ]
set testproc1_sid [ exec $ps --no-headers -o sid $testproc1_pid ] 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" set test "pkill find both test pids"
spawn $pkill -0 -e $testproc_comm spawn $pkill -0 -e $testproc_comm
expect_pass "$test" "^$testproc_comm killed \\(pid $testproc1_pid\\)\\s+$testproc_comm killed \\(pid $testproc2_pid\\)\\s*$" expect_pass "$test" "^$testproc_comm killed \\(pid $testproc1_pid\\)\\s+$testproc_comm killed \\(pid $testproc2_pid\\)\\s*$"
@ -126,6 +132,6 @@ untested "$test"
# Cleanup # Cleanup
exec kill $testproc1_pid eval exec "$kill_path $testproc1_pid"
exec kill $testproc2_pid eval exec "$kill_path $testproc2_pid"
exec rm $testproc_path exec rm $testproc_path