summaryrefslogtreecommitdiffstats
path: root/tools/check-help.sh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-04-05 10:51:21 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-04-05 22:18:31 +0200
commitffb7406ba9c12a58dd944574ab565f39aabb0dfa (patch)
tree0322e40dc38a834566699cbb4e006ff3506c3a9e /tools/check-help.sh
parentMerge pull request #22956 from yuwata/network-fix-permission-error (diff)
downloadsystemd-ffb7406ba9c12a58dd944574ab565f39aabb0dfa.tar.xz
systemd-ffb7406ba9c12a58dd944574ab565f39aabb0dfa.zip
tests: add a smoke test for --version option in binaries
This is very similar to (and directly based on) the test for --help. I think it's nice to do this: the test is very quick, but it'll catch cases where we forgot to hook up the option, or forgot to exit after printing --version, and it'll also increase our test coverage a bit.
Diffstat (limited to 'tools/check-help.sh')
-rwxr-xr-xtools/check-help.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/check-help.sh b/tools/check-help.sh
index 76ac292675..19ec941469 100755
--- a/tools/check-help.sh
+++ b/tools/check-help.sh
@@ -3,8 +3,8 @@
set -eu
set -o pipefail
-# Note: `grep ... >/dev/null` instead of just `grep -q` is used intentionally
-# here, since `grep -q` exits on the first match causing SIGPIPE being
+# Note: 'grep ... >/dev/null' instead of just 'grep -q' is used intentionally
+# here, since 'grep -q' exits on the first match causing SIGPIPE being
# sent to the sender.
BINARY="${1:?}"
@@ -24,11 +24,11 @@ fi
# --help prints something. Also catches case where args are ignored.
if ! "$BINARY" --help | grep . >/dev/null; then
- echo "$(basename "$BINARY") --help output is empty."
+ echo "$(basename "$BINARY") --help output is empty"
exit 2
fi
-# no --help output to stdout
+# no --help output to stderr
if "$BINARY" --help 2>&1 1>/dev/null | grep .; then
echo "$(basename "$BINARY") --help prints to stderr"
exit 3