tests/vmcheck: Display human-readable status on jq failure
So it's easier to debug. This inlines the helper into the only function that uses it. Closes: #1430 Approved by: jlebon
This commit is contained in:
parent
2278b60a15
commit
e1b62d0f7d
@ -359,17 +359,6 @@ skip_one_with_asan () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_status_file_jq() {
|
|
||||||
status_file=$1; shift
|
|
||||||
for expression in "$@"; do
|
|
||||||
if ! jq -e "${expression}" >/dev/null < $status_file; then
|
|
||||||
jq . < $status_file | sed -e 's/^/# /' >&2
|
|
||||||
echo 1>&2 "${expression} failed to match in $status_file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
get_obj_path() {
|
get_obj_path() {
|
||||||
repo=$1; shift
|
repo=$1; shift
|
||||||
csum=$1; shift
|
csum=$1; shift
|
||||||
|
@ -350,9 +350,19 @@ vm_assert_layered_pkg() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Takes a list of `jq` expressions, each of which should evaluate to a boolean,
|
||||||
|
# and asserts that they are true.
|
||||||
vm_assert_status_jq() {
|
vm_assert_status_jq() {
|
||||||
vm_rpmostree status --json > status.json
|
vm_rpmostree status --json > status.json
|
||||||
assert_status_file_jq status.json "$@"
|
vm_rpmostree status > status.txt
|
||||||
|
for expression in "$@"; do
|
||||||
|
if ! jq -e "${expression}" >/dev/null < status.json; then
|
||||||
|
jq . < status.json | sed -e 's/^/# /' >&2
|
||||||
|
echo 1>&2 "${expression} failed to match status.json"
|
||||||
|
cat status.txt
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_pending_is_staged() {
|
vm_pending_is_staged() {
|
||||||
|
Loading…
Reference in New Issue
Block a user