TEST-74-AUX-UTILS.introspect-cli: simplify how --introspect-cli is tested
Afterc9cd66ee3aandc81b5d36b9, 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.
This commit is contained in:
@@ -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"])'
|
||||
|
||||
Reference in New Issue
Block a user