summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorCraig Small <csmall@enc.com.au>2011-12-04 00:50:36 +1100
committerCraig Small <csmall@enc.com.au>2011-12-04 00:50:36 +1100
commite7a0fe5beeaa2d3219f810c13fad43497b0965d8 (patch)
tree2cc8df2d6c8288a8b7c0baf95728859306d3a81e /testsuite
parent3d807ae853b8b4264da156065b34f1447658a8ba (diff)
downloadprocps-ng-e7a0fe5beeaa2d3219f810c13fad43497b0965d8.tar.gz
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
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Makefile.am4
-rw-r--r--testsuite/kill.test/kill.exp36
-rw-r--r--testsuite/pwdx.test/pwdx.exp8
-rw-r--r--testsuite/uptime.test/uptime.exp2
-rw-r--r--testsuite/vmstat.test/vmstat.exp2
-rw-r--r--testsuite/w.test/w.exp2
6 files changed, 31 insertions, 23 deletions
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 9374941..343cded 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -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 = \
diff --git a/testsuite/kill.test/kill.exp b/testsuite/kill.test/kill.exp
index 0849540..bf00fdf 100644
--- a/testsuite/kill.test/kill.exp
+++ b/testsuite/kill.test/kill.exp
@@ -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"
+# }
+#}
diff --git a/testsuite/pwdx.test/pwdx.exp b/testsuite/pwdx.test/pwdx.exp
index c1182fd..20882ca 100644
--- a/testsuite/pwdx.test/pwdx.exp
+++ b/testsuite/pwdx.test/pwdx.exp
@@ -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"
diff --git a/testsuite/uptime.test/uptime.exp b/testsuite/uptime.test/uptime.exp
index 001c4e7..7529fe9 100644
--- a/testsuite/uptime.test/uptime.exp
+++ b/testsuite/uptime.test/uptime.exp
@@ -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*$"
diff --git a/testsuite/vmstat.test/vmstat.exp b/testsuite/vmstat.test/vmstat.exp
index 0adf75a..aa1707f 100644
--- a/testsuite/vmstat.test/vmstat.exp
+++ b/testsuite/vmstat.test/vmstat.exp
@@ -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"
diff --git a/testsuite/w.test/w.exp b/testsuite/w.test/w.exp
index 9341827..2eebab4 100644
--- a/testsuite/w.test/w.exp
+++ b/testsuite/w.test/w.exp
@@ -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+"