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/pwdx | |
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/pwdx')
-rw-r--r-- | debian/tests/pwdx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/debian/tests/pwdx b/debian/tests/pwdx new file mode 100644 index 0000000..0f8639f --- /dev/null +++ b/debian/tests/pwdx @@ -0,0 +1,42 @@ +#!/bin/sh + +exec 2>&1 + +test_no_arguments() { + ( pwdx >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "pwdx exit value" "1" "${rtrn}" + grep 'Usage:' "${stderrF}" > /dev/null + assertTrue 'usage message' $? +} + +test_my_pid() { + ( pwdx "${myPID}" >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "pwdx exit value" "0" "${rtrn}" + + myCWD=$(readlink "/proc/${myPID}/cwd" 2>/dev/null) + [ -z "${myCWD:-}" ] && startSkipping + grep -E "^${myPID}: ${myCWD}" "${stdoutF}" > /dev/null + assertTrue 'pwdx output' $? +} + +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 + |