File: vmstat.exp

package info (click to toggle)
procps 2%3A3.3.9-9%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 4,692 kB
  • sloc: ansic: 21,448; sh: 12,147; exp: 346; makefile: 343; sed: 16
file content (41 lines) | stat: -rw-r--r-- 1,679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#
# 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 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"
} 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+"
untested "$test"

# Need a partition
set diskstats [ exec cat /proc/diskstats ]
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)"
    spawn $vmstat -p $partition
    expect_pass "$test" "^${partition}\\s+reads"
} else {
    unsupported "vmstat partition (cannot find partition)"
}