slabtop: Check for bad d and o option combination
If you run slabtop with the -d option and then -o option the delay gets set to zero and it runs forever. slabtop now checks for this combination and errors. Adding a DEJAGNU test also found that none of the slabtop checks were running so they got added to the list and only the ones that need /proc/slabinfo (if not readable) are skipped. References: #160
This commit is contained in:
@@ -31,6 +31,7 @@ DEJATOOL += \
|
||||
pkill \
|
||||
ps \
|
||||
pwdx \
|
||||
slabtop \
|
||||
uptime \
|
||||
vmstat \
|
||||
w
|
||||
@@ -51,6 +52,7 @@ EXTRA_DIST = \
|
||||
ps.test/ps_personality.exp \
|
||||
ps.test/ps_sched_batch.exp \
|
||||
pwdx.test/pwdx.exp \
|
||||
slabtop.test/slabtop.exp \
|
||||
uptime.test/uptime.exp \
|
||||
vmstat.test/vmstat.exp \
|
||||
w.test/w.exp
|
||||
|
@@ -7,15 +7,20 @@ set avst "Active / Total"
|
||||
set used "\\\(% used\\\)\\s+:"
|
||||
set pct "\\\(\\d+\\.\\d+%\\\)"
|
||||
|
||||
if { [ file readable "/proc/slabinfo" ] == 0 } {
|
||||
unsupported "slabtop tests disabled as /proc/slabinfo is unreadable"
|
||||
} else {
|
||||
set slabtop_header "^ $avst Objects $used \\d+ / \\d+ ${pct}\\s+$avst Slabs $used \\d+ / \\d+ ${pct}\\s+$avst Caches $used \\d+ / \\d+ ${pct}\\s+$avst Size $used \\d+\\.\\d+K / \\d+\\.\\d+K ${pct}\\s+Minimum / Average / Maximum Object : \\d+\\.\\d+K / \\d+\\.\\d+K / \\d+\\.\\d+K\\s+OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME\\s+"
|
||||
|
||||
set test "slabtop help"
|
||||
spawn $slabtop --help
|
||||
expect_pass $test "^\\s+Usage:\\s+\(lt-\)\?slabtop \\\[options\\\]"
|
||||
|
||||
set test "slabtop o then d options"
|
||||
spawn $slabtop -o -d 10
|
||||
expect_pass $test "Cannot combine -d and -o options"
|
||||
|
||||
set test "slabtop d then o options"
|
||||
spawn $slabtop -d 10 -o
|
||||
expect_pass $test "Cannot combine -d and -o options"
|
||||
|
||||
set sort_tests {
|
||||
"a" "active objects" "^\\s*\\d+\\s+(\\d+)\\s+\\d+%\\s+\\d+\\.\\d+K\\s+\\d+\\s+\\d+\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
||||
"b" "objects per slab" "^\\s*\\d+\\s+\\d+\\s+\\d+%\\s+\\d+\\.\\d+K\\s+\\d+\\s+(\\d+)\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
||||
@@ -25,9 +30,16 @@ set sort_tests {
|
||||
"s" "object size" "^\\s*\\d+\\s+\\d+\\s+\\d+%\\s+(\\d+\\.\\d+)K\\s+\\d+\\s+\\d+\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
||||
"u" "utilisation" "^\\s*\\d+\\s+\\d+\\s+(\\d+)%\\s+\\d+\\.\\d+K\\s+\\d+\\s+\\d+\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
||||
}
|
||||
|
||||
# BEGIN - Tests requiring /proc/slabinfo
|
||||
if { [ file readable "/proc/slabinfo" ] == 0 } {
|
||||
unsupported "slabtop tests disabled as /proc/slabinfo is unreadable"
|
||||
} else {
|
||||
|
||||
foreach { flag desc match } $sort_tests {
|
||||
set test "slabtop sorted by $desc"
|
||||
spawn $slabtop -o -s $flag
|
||||
expect_table_dsc $test $slabtop_header $match
|
||||
}
|
||||
}
|
||||
# END - Tests requiring /proc/slabinfo
|
||||
|
Reference in New Issue
Block a user