2011-12-02 17:11:03 +05:30
|
|
|
#
|
|
|
|
# Dehagnu testing for slabtop - part of procps
|
|
|
|
#
|
2022-08-29 14:43:10 +05:30
|
|
|
set slabtop ${topdir}src/slabtop
|
2011-12-02 17:11:03 +05:30
|
|
|
|
|
|
|
set avst "Active / Total"
|
|
|
|
set used "\\\(% used\\\)\\s+:"
|
|
|
|
set pct "\\\(\\d+\\.\\d+%\\\)"
|
|
|
|
|
|
|
|
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
|
2012-01-02 12:09:41 +05:30
|
|
|
expect_pass $test "^\\s+Usage:\\s+\(lt-\)\?slabtop \\\[options\\\]"
|
2011-12-02 17:11:03 +05:30
|
|
|
|
2021-03-11 16:40:37 +05:30
|
|
|
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"
|
|
|
|
|
2011-12-02 17:11:03 +05:30
|
|
|
set sort_tests {
|
2011-12-04 16:38:23 +05:30
|
|
|
"a" "active objects" "^\\s*\\d+\\s+(\\d+)\\s+\\d+%\\s+\\d+\\.\\d+K\\s+\\d+\\s+\\d+\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
2011-12-02 17:11:03 +05:30
|
|
|
"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*"
|
2011-12-04 16:38:23 +05:30
|
|
|
"c" "cache size" "^\\s*\\d+\\s+\\d+\\s+\\d+%\\s+\\d+\\.\\d+K\\s+\\d+\\s+\\d+\\s+(\\d+)K\\s+\\S\[^\r\]+\\s*"
|
|
|
|
"l" "number of slabs" "^\\s*\\d+\\s+\\d+\\s+\\d+%\\s+\\d+\\.\\d+K\\s+(\\d+)\\s+\\d+\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
2023-01-25 15:05:43 +05:30
|
|
|
"o" "object count" "^\\s*(\\d+)\\s+\\d+\\s+\\d+%\\s+\\d+\\.\\d+K\\s+\\d+\\s+\\d+\\s+\\d+K\\s+\\S\[^\r\]+\\s*"
|
|
|
|
"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*"
|
2011-12-02 17:11:03 +05:30
|
|
|
}
|
2021-03-11 16:40:37 +05:30
|
|
|
|
|
|
|
# BEGIN - Tests requiring /proc/slabinfo
|
|
|
|
if { [ file readable "/proc/slabinfo" ] == 0 } {
|
|
|
|
unsupported "slabtop tests disabled as /proc/slabinfo is unreadable"
|
|
|
|
} else {
|
|
|
|
|
2011-12-02 17:11:03 +05:30
|
|
|
foreach { flag desc match } $sort_tests {
|
|
|
|
set test "slabtop sorted by $desc"
|
|
|
|
spawn $slabtop -o -s $flag
|
|
|
|
expect_table_dsc $test $slabtop_header $match
|
|
|
|
}
|
2011-12-04 16:38:23 +05:30
|
|
|
}
|
2021-03-11 16:40:37 +05:30
|
|
|
# END - Tests requiring /proc/slabinfo
|