diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 20:34:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 20:34:44 +0000 |
commit | b08293e544fb5eb5e004f02139e4aa06660395b6 (patch) | |
tree | 4b00360b4f034158a87d15d0d6dd797c42270717 /debian/tests/ps | |
parent | Adding upstream version 2:4.0.4. (diff) | |
download | procps-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/ps')
-rw-r--r-- | debian/tests/ps | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/debian/tests/ps b/debian/tests/ps new file mode 100644 index 0000000..e9cc83b --- /dev/null +++ b/debian/tests/ps @@ -0,0 +1,53 @@ +#!/bin/sh + +exec 2>&1 + +test_no_arguments() { + ( ps >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "ps exit value" "0" "${rtrn}" + grep -E '^[[:space:]]+PID[[:space:]]+TTY[[:space:]]+TIME[[:space:]]+CMD' "${stdoutF}" > /dev/null + assertTrue 'header line' $? +} + +test_pid() { + ( ps -o pid "${myPID}" >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "ps exit value" "0" "${rtrn}" + grep -E '^[[:space:]]+PID$' "${stdoutF}" > /dev/null + assertTrue 'header line' $? + grep -E "^[[:space:]]+${myPID}$" "${stdoutF}" > /dev/null + assertTrue 'pid line' $? +} + +test_exe() { + ( ps -o exe "${myPID}" >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "ps exit value" "0" "${rtrn}" + + myEXE=$(readlink "/proc/${myPID}/exe" 2>/dev/null) + [ -z "${myEXE:-}" ] && startSkipping + grep -E "^${myEXE}$" "${stdoutF}" > /dev/null + assertTrue 'exe line' $? +} + +oneTimeSetUp() { + # Define global variables for command output. + stdoutF="${AUTOPKGTEST_TMP}/stdout" + stderrF="${AUTOPKGTEST_TMP}/stderr" + myPID=$$ +} + +setUp() { + # Truncate the output files. + cp /dev/null "${stdoutF}" + cp /dev/null "${stderrF}" +} + + +# shellcheck disable=SC1091 +. shunit2 + |