summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorCraig Small <csmall@enc.com.au>2015-06-13 15:13:39 +1000
committerCraig Small <csmall@enc.com.au>2015-06-13 15:13:39 +1000
commit54fdbb19a27204751b8eb119f7740a295330850d (patch)
treec857370761d00ca0f4e5d7e0c4f546189071be99 /testsuite
parent420cd9c7c23b558491e7aa99f8a258c1421e867c (diff)
downloadprocps-ng-54fdbb19a27204751b8eb119f7740a295330850d.tar.gz
Skip tests where /proc/vmstat unreadable
testsuite would fail if /proc/vmstat was unreadable. Issue #3 brought up by Mike Frysinger. test script explicitly checks to see if it is readable and sets these tests to unsupported if not.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/vmstat.test/vmstat.exp30
1 files changed, 18 insertions, 12 deletions
diff --git a/testsuite/vmstat.test/vmstat.exp b/testsuite/vmstat.test/vmstat.exp
index 0bc00b4..b044903 100644
--- a/testsuite/vmstat.test/vmstat.exp
+++ b/testsuite/vmstat.test/vmstat.exp
@@ -4,18 +4,24 @@
set vmstat "${topdir}vmstat"
-# Run vmstat with no arguments
-set test "vmstat with no arguments"
-spawn $vmstat
-expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+buff\\s+cache\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$"
-
-set test "vmstat with -a flag"
-spawn $vmstat -a
-expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+inact\\s+active\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$"
-
-set test "vmstat fork option"
-spawn $vmstat -f
-expect_pass "$test" "^\\s+\\d+ forks\\s*$"
+# Tests that need to see /proc/vmstat
+if { [ file readable "/proc/vmstat" ] == 0 } {
+ unsupported "vmstat with no arguments - /proc/vmstat is unreadable"
+ unsupported "vmstat with -a flag - /proc/vmstat is unreadable"
+ unsupported "vmstat fork option - /proc/vmstat is unreadable"
+} else {
+ set test "vmstat with no arguments"
+ spawn $vmstat
+ expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+buff\\s+cache\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$"
+
+ set test "vmstat with -a flag"
+ spawn $vmstat -a
+ expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+inact\\s+active\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$"
+
+ set test "vmstat fork option"
+ spawn $vmstat -f
+ expect_pass "$test" "^\\s+\\d+ forks\\s*$"
+}
if { [ file readable "/proc/slabinfo" ] == 0 } {
unsupported "slabinfo (-m option) test disabled as /proc/slabinfo is unreadable"