]> granicus.if.org Git - procps-ng/commitdiff
added uptime and vmstat tests
authorCraig Small <csmall@enc.com.au>
Sun, 27 Nov 2011 08:12:56 +0000 (19:12 +1100)
committerCraig Small <csmall@enc.com.au>
Sun, 27 Nov 2011 08:12:56 +0000 (19:12 +1100)
testsuite/Makefile.am
testsuite/config/unix.exp
testsuite/uptime.test/uptime.exp [new file with mode: 0644]
testsuite/vmstat.test/vmstat.exp [new file with mode: 0644]

index 7786ee1b1516ddd7b0effa89eaccc1a54e021945..35a41d3f105a9cf5605d74295fd0a0c959ef316a 100644 (file)
@@ -6,6 +6,8 @@ DEJATOOL = \
                   pgrep \
                   pmap \
                   pwdx \
+                  uptime \
+                  vmstat \
                   w
                
        
index 57870bceeec2e76f5cc37c478dc9f79d11f9aebb..5ffb3eca73c6e2de1418751a5a84464790993e6e 100644 (file)
@@ -20,6 +20,16 @@ proc free_version {} {
   clone_output "${topdir}free version $version\n"
 }
 
+# uptime functions
+proc uptime_load { arg } { }
+proc uptime_exit {} {}
+proc uptime_version {} {
+  global topdir
+  set tmp [ exec ${topdir}uptime -V ]
+  regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
+  clone_output "${topdir}uptime version $version\n"
+}
+
 # w functions
 proc w_load { arg } { }
 proc w_exit {} {}
diff --git a/testsuite/uptime.test/uptime.exp b/testsuite/uptime.test/uptime.exp
new file mode 100644 (file)
index 0000000..4177ac9
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# Dejagnu tests for uptime - part of procps
+#
+set uptime "${topdir}uptime"
+
+set test "uptime"
+spawn $uptime
+expect_pass "$test" "^\\s+\\d{2}:\\d{2}:\\d{2} up (\\d+ days?,)\\s*\\d+(min|:\\d+), +\\d+ users, +load average: \[0-9.\]+, \[0-9.\]+, \[0-9.\]+\\s*$"
diff --git a/testsuite/vmstat.test/vmstat.exp b/testsuite/vmstat.test/vmstat.exp
new file mode 100644 (file)
index 0000000..0adf75a
--- /dev/null
@@ -0,0 +1,36 @@
+
+#
+# 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*$"
+
+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+\)" $diskstats -> partition
+set test "vmstat partition"
+spawn $vmstat -p $partition
+expect_pass "$test" "^${partition}\\s+reads"
+#\\s+read sectors\\s+writes\\s+requested writes"
+#\(\\s+\\d+\){4}\\s*$"