Fixing tests due to some results

Makefile will now only test for Linux systems, a work around in the
makefile due to some silly redefine restrictions.

uptime and w now won't error due to being one user logged in, thanks to
Sami for the patch

kill processes by pid test commented out due to false negatives

pwdx process 1 check also commented out due to false negatives
This commit is contained in:
Craig Small 2011-12-04 00:50:36 +11:00
parent 3d807ae853
commit e7a0fe5bee
6 changed files with 31 additions and 23 deletions

View File

@ -3,7 +3,7 @@ export DEJAGNU
if LINUX
# Programs that are expected across the board
DEJATOOL = \
test_tools = \
free \
pgrep \
pkill \
@ -15,6 +15,8 @@ DEJATOOL = \
sysctl slabtop pmap kill
endif
DEJATOOL = $(test_tools)
EXTRA_DIST = \

View File

@ -3,7 +3,6 @@
#
set kill ${topdir}kill
set test "kill with no arguments"
spawn $kill
expect_pass "$test" "Usage:\\s+kill pid ...\\s+Send SIGTERM to every process listed.\\r\\s+kill signal pid ...\\s+Send a signal to every process listed.\\r\\s+kill -s signal pid ...\\s+Send a signal to every process listed.\\r\\s+kill -l\\s+List all signal names.\\r\\s+kill -L\\s+List all signal names in a nice table.\\r\\s+kill -l signal\\s+Convert between signal numbers and names."
@ -24,19 +23,26 @@ set test "kill convert signal number to name"
spawn $kill -l 1
expect_pass "$test" "^HUP\\s*"
set test "kill numbered process"
make_testproc
if { [ file isdirectory "/proc/$testproc1_pid" ] && [ file isdirectory "/proc/$testproc2_pid" ] } {
} else {
perror "Could not start test processes"
}
set foo [ exec $kill -KILL $testproc1_pid $testproc2_pid ]
wait
wait
if { [ file exists "/proc/$testproc1_pid" ] || [ file exists "/proc/$testproc2_pid" ] } {
fail "$test"
} else {
pass "$test"
}
#set test "kill numbered process"
#make_testproc
#if { [ file isdirectory "/proc/$testproc1_pid" ] && [ file isdirectory "/proc/$testproc2_pid" ] } {
#} else {
# perror "Could not start test processes"
#}
#exec $kill -KILL $testproc1_pid
#wait
#if { [ file exists "/proc/$testproc1_pid" ] } {
# exec kill $testproc2_pid
# fail "$test (proc 1 exists)"
#} else {
# exec $kill -KILL $testproc2_pid
# wait
# if { [ file exists "/proc/$testproc2_pid" ] } {
# exec kill $testproc2_pid
# fail "$test (proc 2 exists)"
# } else {
# pass "$test"
# }
#}

View File

@ -5,10 +5,10 @@ set test "pwdx no args"
spawn $pwdx
expect_pass "$test" "^Usage: pwdx pid\.\.\."
# Run pwdx with pid 1 which is not reachable
set test "pwdx pid 1 should give permission denied"
spawn $pwdx 1
expect_pass "$test" "^1: Permission denied"
# Run pwdx with pid 0 which is invalid
set test "pwdx pid 0 should be invalid"
spawn $pwdx 0
expect_pass "$test" "^pwdx: invalid process id"
# Run pwdx with existing pid
set test "pwdx finds sleep in cwd"

View File

@ -5,4 +5,4 @@ set uptime "${topdir}uptime"
set test "uptime"
spawn $uptime
expect_pass "$test" "^\\s+\\d{2}:\\d{2}:\\d{2} up (\\d+ days?,)?\\s*\\d+(min|:\\d+), +\\d+ users, +load average: \[0-9.\]+, \[0-9.\]+, \[0-9.\]+\\s*$"
expect_pass "$test" "^\\s+\\d{2}:\\d{2}:\\d{2} up (\\d+ days?,)?\\s*\\d+(min|:\\d+), +\\d+ users?, +load average: \[0-9.\]+, \[0-9.\]+, \[0-9.\]+\\s*$"

View File

@ -29,7 +29,7 @@ expect_pass "$test" "^disk\[ -\]+reads\[ -\]+writes\[ -\]+IO\[ -\]+\\s+total\\s+
# Need a partition
set diskstats [ exec cat /proc/diskstats ]
regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)" $diskstats -> partition
set test "vmstat partition"
set test "vmstat partition (using $partition)"
spawn $vmstat -p $partition
expect_pass "$test" "^${partition}\\s+reads"
#\\s+read sectors\\s+writes\\s+requested writes"

View File

@ -4,7 +4,7 @@
# FIXME - the user lines only go to idle
set w "${topdir}w"
set w_uptime "\\s+\\d{2}:\\d{2}:\\d{2} up (\\d+ days?,)?\\s*\\d+(min|:\\d+), +\\d+ users, +load average: \[0-9.\]+, \[0-9.\]+, \[0-9.\]+\\s+"
set w_uptime "\\s+\\d{2}:\\d{2}:\\d{2} up (\\d+ days?,)?\\s*\\d+(min|:\\d+), +\\d+ users?, +load average: \[0-9.\]+, \[0-9.\]+, \[0-9.\]+\\s+"
set w_std_header "${w_uptime}USER\\s+TTY\\s+LOGIN@\\s+IDLE\\s+JCPU\\s+PCPU\\s+WHAT\\s+"
set w_short_header "${w_uptime}USER\\s+TTY\\s+IDLE\\s+WHAT\\s+"
set w_from_header "${w_uptime}USER\\s+TTY\\s+FROM\\s+LOGIN@\\s+IDLE\\s+JCPU\\s+PCPU\\s+WHAT\\s+"