From 494701162fac1b2393599c8cf5e296297ed92941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 16 Aug 2026 16:52:16 +0200 Subject: [PATCH] TEST-74-AUX-UTILS.introspect-cli: verify that --help works This is redundant for public programs, for which we test --help more extensively, but is also good as a basic check that e.g. the program name used to print help matches what is specified in COMMAND. --- test/units/TEST-74-AUX-UTILS.introspect-cli.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index f7a880859c..9c094de882 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -7,6 +7,8 @@ set -o pipefail # Check the other location too. PATH=$PATH:/usr/lib/systemd +export SYSTEMD_PAGER=cat + # A smoke test for the introspection code INTROSPECTABLE=( homectl @@ -45,6 +47,8 @@ INTROSPECTABLE=( for i in "${INTROSPECTABLE[@]}"; do command -v "$i" >/dev/null || continue + $i --help >/dev/null + $i --introspect-cli | jq -e \ '.mediaType == "application/vnd.io.systemd.cli-introspection-0"' $i --introspect-cli | jq -e --arg name "$i" \ @@ -57,10 +61,10 @@ done # systemd-hwdb defines verbs, check that they are described if command -v systemd-hwdb >/dev/null; then systemd-hwdb --introspect-cli | jq -e \ - '.commands[0].verbs | map(.names[0]) | contains(["query", "update"])' + '.commands[0].verbs | map(.names[0]) | sort == ["help", "query", "update"]' fi -# systemd-id128 defines verbs, check that they are described +# systemd-id128 defines many verbs, check that some are described systemd-id128 --introspect-cli | jq -e \ '.commands[0].verbs | map(.names[0]) | contains(["new", "machine-id", "show", "help"])'