]> granicus.if.org Git - procps-ng/commitdiff
Conditional test vmstat -p
authorCraig Small <csmall@enc.com.au>
Wed, 31 Jul 2013 11:54:53 +0000 (21:54 +1000)
committerCraig Small <csmall@enc.com.au>
Wed, 31 Jul 2013 11:54:53 +0000 (21:54 +1000)
testsuite/vmstat.test/vmstat.exp

index 328e2fc5bdf27445a70973cc7ff1b39c757f30a2..76ea310de9582d886fba55e63b49dbf30fa3ebf1 100644 (file)
@@ -31,9 +31,10 @@ 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+\)\\s+\(\[0-9\]\[0-9\]+\)" $diskstats -> 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"
-#\(\\s+\\d+\){4}\\s*$"
+if [ regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] {
+    set test "vmstat partition (using $partition)"
+    spawn $vmstat -p $partition
+    expect_pass "$test" "^${partition}\\s+reads"
+} else {
+    unsupported "vmstat partition (cannot find partition)"
+}