From 34f68e808a95413cbbbe46ce1b77e4aa3e6d5691 Mon Sep 17 00:00:00 2001 From: "Klaus T. Aehlig" Date: Mon, 5 Feb 2024 11:56:52 +0100 Subject: 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. --- test/end-to-end/actions/action-equality-timeout.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test') 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 -- cgit v1.2.3