diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 1 | ||||
-rwxr-xr-x | test/test-bootctl-json.sh | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index f2080b5a9a..93f0e679fe 100644 --- a/test/meson.build +++ b/test/meson.build @@ -89,6 +89,7 @@ if install_tests install_dir : testdata_dir) endif +test_bootctl_json_sh = find_program('test-bootctl-json.sh') test_fstab_generator_sh = find_program('test-fstab-generator.sh') test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh') test_systemctl_enable_sh = find_program('test-systemctl-enable.sh') diff --git a/test/test-bootctl-json.sh b/test/test-bootctl-json.sh new file mode 100755 index 0000000000..7a660a8ea7 --- /dev/null +++ b/test/test-bootctl-json.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -e +set -o pipefail + +bootctl="${1:?}" + +"$bootctl" --no-pager list >/dev/null || { + echo "$bootctl list failed, skipping tests" 1>&2 + exit 77 +} + +set -x + +"$bootctl" list --json=pretty | python3 -m json.tool >/dev/null +"$bootctl" list --json=short | python3 -m json.tool >/dev/null + +command -v jq >/dev/null || { + echo "jq is not available, skipping jq tests" 1>&2 + exit 0 +} + +"$bootctl" list --json=pretty | jq . >/dev/null +"$bootctl" list --json=short | jq . >/dev/null |