summaryrefslogtreecommitdiffstats
path: root/debian/tests/vmstat
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
commitb08293e544fb5eb5e004f02139e4aa06660395b6 (patch)
tree4b00360b4f034158a87d15d0d6dd797c42270717 /debian/tests/vmstat
parentAdding upstream version 2:4.0.4. (diff)
downloadprocps-b08293e544fb5eb5e004f02139e4aa06660395b6.tar.xz
procps-b08293e544fb5eb5e004f02139e4aa06660395b6.zip
Adding debian version 2:4.0.4-4.debian/2%4.0.4-4debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/vmstat')
-rw-r--r--debian/tests/vmstat58
1 files changed, 58 insertions, 0 deletions
diff --git a/debian/tests/vmstat b/debian/tests/vmstat
new file mode 100644
index 0000000..9907d42
--- /dev/null
+++ b/debian/tests/vmstat
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+exec 2>&1
+
+test_no_arguments() {
+ ( vmstat >"${stdoutF}" 2>"${stderrF}" )
+ rtrn=$?
+
+ assertEquals "vmstat exit value" "0" "${rtrn}"
+
+ grep -E '^procs[ -]+memory[ -]+swap[ -]+io[ -]+system[ -]+cpu[ -]+$' "${stdoutF}" > /dev/null
+ assertTrue 'header line' $?
+ grep -E '^ +r +b +swpd +free +buff +cache +si +so +bi +bo +in +cs us sy id wa st gu$' "${stdoutF}" >/dev/null
+ assertTrue 'header second line' $?
+ grep -E '^([[:space:]]+[[:digit:]]+){18}$' "${stdoutF}" >/dev/null
+ assertTrue 'value line' $?
+}
+
+test_forks() {
+ ( vmstat -f >"${stdoutF}" 2>"${stderrF}" )
+ rtrn=$?
+
+ assertEquals "vmstat -f exit value" "0" "${rtrn}"
+
+ grep -E '^[[:space:]]+[[:digit:]]+ forks$' "${stdoutF}" > /dev/null
+ assertTrue 'fork output' $?
+}
+
+test_disk() {
+ ( vmstat -d >"${stdoutF}" 2>"${stderrF}" )
+ rtrn=$?
+
+ assertEquals "vmstat -d exit value" "0" "${rtrn}"
+
+ grep -E '^disk[ -]+reads[ -]+writes[ -]+IO[ -]+$' "${stdoutF}" > /dev/null
+ assertTrue 'header line' $?
+ grep -E '^ +total +merged +sectors +ms +total +merged +sectors +ms +cur +sec$' "${stdoutF}" >/dev/null
+ assertTrue 'header second line' $?
+ grep -E '^[[:alnum:]]+([[:space:]]+[[:digit:]]+){10}$' "${stdoutF}" >/dev/null
+ assertTrue 'value line' $?
+}
+
+oneTimeSetUp() {
+ # Define global variables for command output.
+ stdoutF="${AUTOPKGTEST_TMP}/stdout"
+ stderrF="${AUTOPKGTEST_TMP}/stderr"
+}
+
+setUp() {
+ # Truncate the output files.
+ cp /dev/null "${stdoutF}"
+ cp /dev/null "${stderrF}"
+}
+
+
+# shellcheck disable=SC1091
+. shunit2
+