mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-22 18:12:49 +00:00
Improve test defs: setup_jq()
For test fixtures that need the jq(1) JSON filter utility
This commit is contained in:
parent
70af3289f6
commit
f3f39faf84
21
testdefs.sh
21
testdefs.sh
@ -760,3 +760,24 @@ setup_curl() {
|
|||||||
esac
|
esac
|
||||||
fail "cannot parse output of curl --version: $ver"
|
fail "cannot parse output of curl --version: $ver"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Setup function:
|
||||||
|
# - ensure that version 1.2 or later of the jq(1) utility is available
|
||||||
|
setup_jq() {
|
||||||
|
local minversion="${1?}"
|
||||||
|
local ver="$(jq --version 2>&1)"
|
||||||
|
case "$ver" in
|
||||||
|
'')
|
||||||
|
fail "jq(1) command is not present"
|
||||||
|
;;
|
||||||
|
jq\ version\ *)
|
||||||
|
set -- $ver
|
||||||
|
tfw_cmp_version "$3" "$minversion"
|
||||||
|
case $? in
|
||||||
|
0|2) return 0;;
|
||||||
|
esac
|
||||||
|
fail "jq(1) version $3 is not adequate (need $minversion or higher)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fail "cannot parse output of jq --version: $ver"
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user