summaryrefslogtreecommitdiffstats
path: root/debian/tests/uptime
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/uptime
parentAdding upstream version 2:4.0.4. (diff)
downloadprocps-debian.tar.xz
procps-debian.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/uptime')
-rw-r--r--debian/tests/uptime39
1 files changed, 39 insertions, 0 deletions
diff --git a/debian/tests/uptime b/debian/tests/uptime
new file mode 100644
index 0000000..3550a8b
--- /dev/null
+++ b/debian/tests/uptime
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+exec 2>&1
+
+test_no_arguments() {
+ ( uptime >"${stdoutF}" 2>"${stderrF}" )
+ rtrn=$?
+
+ assertEquals "uptime exit value" "0" "${rtrn}"
+ grep -E '^[[:space:]]+[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}' "${stdoutF}" > /dev/null
+ assertTrue 'time' $?
+ grep -E ' load average: [[:digit:].]+, [[:digit:].]+, [[:digit:].]+$' "${stdoutF}" > /dev/null
+ assertTrue 'load average' $?
+}
+
+test_no_header() {
+ ( w -h >"${stdoutF}" 2>"${stderrF}" )
+ rtrn=$?
+
+ assertEquals "w exit value" "0" "${rtrn}"
+ grep -E '^USER[[:space:]]+TTY[[:space:]]+FROM' "${stdoutF}" > /dev/null
+ assertFalse 'header line with -h option' $?
+}
+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
+