]>
Commit | Line | Data |
---|---|---|
7629744a | 1 | #!/bin/sh |
2 | set -eu | |
005a29f2 | 3 | |
07b3a026 YW |
4 | export SYSTEMD_LOG_LEVEL=info |
5 | ||
005a29f2 ZJS |
6 | # output width |
7 | if "$1" --help | grep -v 'default:' | grep -E -q '.{80}.'; then | |
cc5549ca ZJS |
8 | echo "$(basename "$1") --help output is too wide:" |
9 | "$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}' | |
10 | exit 1 | |
005a29f2 ZJS |
11 | fi |
12 | ||
cdfa3f0c ZJS |
13 | # --help prints something. Also catches case where args are ignored. |
14 | if ! "$1" --help | grep -q .; then | |
15 | echo "$(basename "$1") --help output is empty." | |
16 | exit 2 | |
17 | fi | |
18 | ||
005a29f2 ZJS |
19 | # no --help output to stdout |
20 | if "$1" --help 2>&1 1>/dev/null | grep .; then | |
cc5549ca | 21 | echo "$(basename "$1") --help prints to stderr" |
cdfa3f0c | 22 | exit 3 |
005a29f2 ZJS |
23 | fi |
24 | ||
25 | # error output to stderr | |
26 | if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then | |
cc5549ca | 27 | echo "$(basename "$1") with an unknown parameter does not print to stderr" |
cdfa3f0c | 28 | exit 4 |
005a29f2 | 29 | fi |