blob: 0f8639fc58736a572f12e07e0264f4a5c0711cf7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
|