From aa3f72ba653c1444f4238ecb6e596aac6c20d1cb Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 3 May 2024 13:20:24 +0200 Subject: Include environment in action reporting on the command line Compared to the command line, the environment usually is quite short. So including it in messages reporting about commands does not introduce a lot of additional noise. However, knowing the environment can help understanding an error message. Therefore, it seems a good trade off to include it. Do so. --- test/end-to-end/actions/error-reporting.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/end-to-end/actions/error-reporting.sh b/test/end-to-end/actions/error-reporting.sh index 8705e6ec..e33b4b77 100644 --- a/test/end-to-end/actions/error-reporting.sh +++ b/test/end-to-end/actions/error-reporting.sh @@ -25,7 +25,7 @@ touch ROOT cat > TARGETS <<'EOF' { "theTargetCausingTheFailure": { "type": "generic" - , "arguments_config": ["foo", "bar"] + , "arguments_config": ["foo", "bar", "magic"] , "outs": ["a.txt"] , "cmds": [ { "type": "join" @@ -33,11 +33,17 @@ cat > TARGETS <<'EOF' [ "echo -n stdout-of-; echo failing-target-" , {"type": "var", "name": "foo", "default": ""} , {"type": "var", "name": "bar", "default": ""} + , "-$MAGIC_VAR" ] } , "touch a.txt" , "exit 42" ] + , "env": + { "type": "singleton_map" + , "key": "MAGIC_VAR" + , "value": {"type": "var", "name": "magic", "default": "unknown"} + } } } EOF @@ -49,7 +55,7 @@ echo mkdir -p "${OUT}" "${JUST}" build --local-build-root "${LBR}" \ -f "${OUT}/log" --log-limit 0 \ - -D '{"foo": "FOO", "irrelevant": "abc"}' \ + -D '{"foo": "FOO", "irrelevant": "abc", "magic":"xyz"}' \ 2>&1 && exit 1 || : # The exit code should be reported @@ -60,15 +66,19 @@ grep theTargetCausingTheFailure "${OUT}/log" # The pruned effective configuration should be reported in canonical # compact form. -grep '{"foo":"FOO"}' "${OUT}/log" +grep '{"foo":"FOO","magic":"xyz"}' "${OUT}/log" # At default level we should also find stdout of the target echo "${JUST}" build --local-build-root "${LBR}" \ -f "${OUT}/log.default" \ - -D '{"foo": "FOO", "irrelevant": "abc"}' \ + -D '{"foo": "FOO", "irrelevant": "abc", "magic":"xyz"}' \ 2>&1 && exit 1 || : -grep stdout-of-failing-target-FOO "${OUT}/log.default" +grep stdout-of-failing-target-FOO-xyz "${OUT}/log.default" + +# ... as well as command and environment in canonical compact form +grep 'echo -n stdout-of-;' "${OUT}/log.default" +grep '{"MAGIC_VAR":"xyz"}' "${OUT}/log.default" echo OK -- cgit v1.2.3