]> granicus.if.org Git - procps-ng/commitdiff
Fixing tests due to some results
authorCraig Small <csmall@enc.com.au>
Sat, 3 Dec 2011 13:50:36 +0000 (00:50 +1100)
committerCraig Small <csmall@enc.com.au>
Sat, 3 Dec 2011 13:50:36 +0000 (00:50 +1100)
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

testsuite/Makefile.am
testsuite/kill.test/kill.exp
testsuite/pwdx.test/pwdx.exp
testsuite/uptime.test/uptime.exp
testsuite/vmstat.test/vmstat.exp
testsuite/w.test/w.exp

index 9374941e572985e20bd39c400e2550aec1eca40e..343cded5a388a13eb8c98476740a5121929e28d8 100644 (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 = \
index 08495400766088012f3e071cc8d37f6ae89b5e94..bf00fdf25e9f65bc217fde268ea2f7d46a76c35f 100644 (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"
+#    }
+#}
 
 
index c1182fdc131ac40a6a32c7c361e60a42856f1bda..20882ca1a36c0f08e221c8086608d83e9c10345d 100644 (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"
index 001c4e7f5da27c4329631b31837c77af151de7c1..7529fe92d4d625ec0801067af8669812fe7b46c3 100644 (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*$"
index 0adf75a8cc06c74744b80ec7fc4f0a75608b78c6..aa1707facc67c137ed7040569c939d6adab4488c 100644 (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"
index 93418276de649d2e56f3cbc44d8d9335d1108af3..2eebab428aa7f9d69a9cd71f16a4e4303e3ee91d 100644 (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+"