Reduced partition type check

vmstat -p checks used to fail on systems with odd
partition tables, including some Debian buildd servers.
This change limits what sort of test partitions are used,
otherwise the test is skipped.

There probably are other valid partitions, these can be added
later, if known.
This commit is contained in:
Craig Small 2014-05-27 20:49:16 +10:00
parent 0b3f63456a
commit f4cc9720ee

View File

@ -38,7 +38,7 @@ set diskstats [ exec cat /proc/diskstats ]
if { [ file readable "/sys/block" ] == 0 } { if { [ file readable "/sys/block" ] == 0 } {
unsupported "vmstat partition /sys/block not readable" unsupported "vmstat partition /sys/block not readable"
} else { } else {
if [ regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] { if [ regexp "\\s+\\d+\\s+\\d+\\s+\((?:hd|sd|vd)\[a-z\]\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] {
set test "vmstat partition (using $partition)" set test "vmstat partition (using $partition)"
spawn $vmstat -p $partition spawn $vmstat -p $partition
expect_pass "$test" "^${partition}\\s+reads" expect_pass "$test" "^${partition}\\s+reads"