blob: 60fdeaf5460f774a21c2dd2c2e2a7b975acfc2a6 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/sh
exec 2>&1
test_no_arguments() {
( pmap >"${stdoutF}" 2>"${stderrF}" )
rtrn=$?
assertEquals "pmap exit value" "1" "${rtrn}"
grep 'Usage:' "${stderrF}" > /dev/null
assertTrue 'usage message' $?
}
test_my_pid() {
( pmap "${myPID}" >"${stdoutF}" 2>"${stderrF}" )
rtrn=$?
assertEquals "pmap exit value" "0" "${rtrn}"
grep -E "^${myPID}: " "${stdoutF}" > /dev/null
assertTrue 'pmap header' $?
grep -E "^[[:space:]]+total +[[:digit:]]+K$" "${stdoutF}" > /dev/null
assertTrue 'pmap total' $?
}
test_device_format() {
( pmap -d "${myPID}" >"${stdoutF}" 2>"${stderrF}" )
rtrn=$?
assertEquals "pmap exit value" "0" "${rtrn}"
grep -E "^${myPID}: " "${stdoutF}" > /dev/null
assertTrue 'pmap header' $?
grep -E "^Address +Kbytes +Mode +Offset +Device +Mapping$" "${stdoutF}" > /dev/null
assertTrue 'pmap header' $?
grep -E "^mapped: [[:digit:]]+K +writeable/private: [[:digit:]]+K +shared: [[:digit:]]+K$" "${stdoutF}" > /dev/null
assertTrue 'pmap total' $?
}
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
|