summaryrefslogtreecommitdiffstats
path: root/testsuite/slabtop.test/slabtop.exp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 20:34:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 20:34:44 +0000
commite3be059d4da38aa36f1aee1d56f8ceb943d92f1c (patch)
tree26edef31e4e503dd1c92a112de174f366dd61802 /testsuite/slabtop.test/slabtop.exp
parentInitial commit. (diff)
downloadprocps-e3be059d4da38aa36f1aee1d56f8ceb943d92f1c.tar.xz
procps-e3be059d4da38aa36f1aee1d56f8ceb943d92f1c.zip
Adding upstream version 2:4.0.4.upstream/2%4.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/slabtop.test/slabtop.exp')
-rw-r--r--testsuite/slabtop.test/slabtop.exp45
1 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/slabtop.test/slabtop.exp b/testsuite/slabtop.test/slabtop.exp
new file mode 100644
index 0000000..2ef0336
--- /dev/null
+++ b/testsuite/slabtop.test/slabtop.exp
@@ -0,0 +1,45 @@
+#
+# Dehagnu testing for slabtop - part of procps
+#
+set slabtop ${topdir}src/slabtop
+
+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
+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*"
+ "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*"
+ "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*"
+ }
+
+# 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