From f25a3d32403ae6100fddc8aaee7c5a2e1827e8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 15 Aug 2026 12:32:45 +0200 Subject: [PATCH] TEST-74-AUX-UTILS.introspect-cli: simplify how --introspect-cli is tested After c9cd66ee3ac0c1be534b3f2fea2756a966cefd1f and c81b5d36b9be4403feb76b92a7505e0b2b53c5ef, the comment about systemd-backlight and systemd-veritysetup was outdated. We can test them as any other program. Also, use an array to make list easier to extend in the future and adjust $PATH so we don't need to care about the split between public and non-public programs. --- .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index 8e8789bd31..c132141fe6 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -3,9 +3,27 @@ set -eux set -o pipefail -# Just a smoke test for the introspection code -for i in systemd-ac-power systemd-analyze systemd-ask-password systemd-dissect \ - systemd-id128 systemd-notify homectl resolvectl timedatectl varlinkctl; do +# Some commands are in $PATH, others are in our private directory. +# Check the other location too. +PATH=$PATH:/usr/lib/systemd + +# A smoke test for the introspection code +INTROSPECTABLE=( + homectl + resolvectl + systemd-ac-power + systemd-analyze + systemd-ask-password + systemd-backlight + systemd-dissect + systemd-id128 + systemd-notify + systemd-veritysetup + timedatectl + varlinkctl +) + +for i in "${INTROSPECTABLE[@]}"; do command -v "$i" >/dev/null || continue $i --introspect-cli | jq -e \ @@ -17,15 +35,6 @@ for i in systemd-ac-power systemd-analyze systemd-ask-password systemd-dissect \ $i --intro | grep -e --help done -# Those are not in $PATH and do not do regular option parsing, so the option must -# be given verbatim -for i in /usr/lib/systemd/systemd-backlight /usr/lib/systemd/systemd-veritysetup; do - [[ -x "$i" ]] || continue - - $i --introspect-cli | jq -e \ - '.mediaType == "application/vnd.io.systemd.cli-introspection-0"' -done - # systemd-id128 defines verbs, check that they are described systemd-id128 --introspect-cli | jq -e \ '.commands[0].verbs | map(.names[0]) | contains(["new", "machine-id", "show", "help"])'