mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
![Zbigniew Jędrzejewski-Szmek](/assets/img/avatar_default.png)
python's json.tool module is used because it does validation. jq is more forgiving. Also, json is in the stdlib, so it should be always available.
25 lines
548 B
Bash
Executable file
25 lines
548 B
Bash
Executable file
#!/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
|