summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus T. Aehlig <aehlig@linta.de>2024-02-05 11:56:52 +0100
committerKlaus T. Aehlig <aehlig@linta.de>2024-02-05 16:24:18 +0100
commit34f68e808a95413cbbbe46ce1b77e4aa3e6d5691 (patch)
tree6f15ace54ef657be59a81b67627702500b159354
parent7f618e71d0894cbd3b9a532fae311130751128ec (diff)
downloadjustbuild-34f68e808a95413cbbbe46ce1b77e4aa3e6d5691.tar.gz
end-to-end tests: compare json values with jq
... and only let test do the check on the final resulting boolean, where the string representation is canonical. In this way, we avoid having to rely on the string representation of numbers, where, e.g., 1 and 1.0 are equally valid representations of the same number.
-rwxr-xr-xtest/end-to-end/actions/action-equality-timeout.sh18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/end-to-end/actions/action-equality-timeout.sh b/test/end-to-end/actions/action-equality-timeout.sh
index de7dca18..37f683cc 100755
--- a/test/end-to-end/actions/action-equality-timeout.sh
+++ b/test/end-to-end/actions/action-equality-timeout.sh
@@ -92,22 +92,22 @@ echo
cd "${ROOT}/${variant}"
"${JUST}" analyse --local-build-root "${LBRDIR}" --dump-graph graph-null.json 2>&1
-action_configs=$(cat graph-null.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.TIMEOUT ]] | sort')
-echo "${action_configs}"
-[ "${action_configs}" = '[[1,null]]' ]
+cat graph-null.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.TIMEOUT ]] | sort' > action_configs
+cat action_configs
+[ "$(jq -acM '. == [[1,null]]' action_configs)" = "true" ]
echo
"${JUST}" analyse --local-build-root "${LBRDIR}" -D '{"TIMEOUT": 1.0}' --dump-graph graph-1.json 2>&1
-action_configs=$(cat graph-1.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.TIMEOUT ]] | sort')
-echo "${action_configs}"
-[ "${action_configs}" = '[[1,null]]' ]
+cat graph-1.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.TIMEOUT ]] | sort' > action_configs
+cat action_configs
+[ "$(jq -acM '. == [[1,null]]' action_configs)" = "true" ]
echo
"${JUST}" analyse --local-build-root "${LBRDIR}" -D '{"TIMEOUT": 2.0}' --dump-graph graph-2.json 2>&1
cat graph-2.json
-action_configs=$(cat graph-2.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.TIMEOUT ]] | sort')
-echo "${action_configs}"
-[ "${action_configs}" = '[[1,null],[2]]' ]
+cat graph-2.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.TIMEOUT ]] | sort' > action_configs
+cat action_configs
+[ "$(jq -acM '. == [[1,null],[2]]' action_configs)" = "true" ]
echo "variant ${variant} OK"
echo