procps/testsuite/vmstat.test/vmstat.exp
Sami Kerola 4d8f9522a7 tests: fix dejagnu pwdx and vmstat checks
The pwdx check expected error message, which where in use for only
short period of time.  The old message was put in place in commit
9d47cb0c38

The vmstat issue was triggered by 'sr0' cdrom device, which gives
following unexpected output.  Fix simply ignores partitions which has
zero activity.  Besides such partitions probably would not apply as
good candidate of -p option anyway.

$ vmstat -p sr0
Partition was not found

Reported-By: Moritz Muehlenhoff <jmm@debian.org>
Bug-Debian: http://bugs.debian.org/656508
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-11 21:42:21 +01:00

40 lines
1.6 KiB
Plaintext

#
# Dejagnu tests for vmstat - part of procps
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\\s*\(\\s+\\d+\){16}\\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\\s*\(\\s+\\d+\){16}\\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"
} else {
set test "vmstat slabinfo (-m option)"
spawn $vmstat -m
expect_pass "$test" "^Cache\\s+Num\\s+Total\\s+Size\\s+Pages\\s+\(\[\(\)A-Za-z0-9_-\]+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*\){1,}"
}
set test "vmstat disk information (-d option)"
spawn $vmstat -d
expect_pass "$test" "^disk\[ -\]+reads\[ -\]+writes\[ -\]+IO\[ -\]+\\s+total\\s+merged\\s+sectors\\s+ms\\s+total\\s+merged\\s+sectors\\s+ms\\s+cur\\s+sec\\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*$"