diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-04-11 15:31:09 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-04-11 17:40:38 +0200 |
commit | 4c92586dad14eba9b9ea64cc8c6f68d6c59eed86 (patch) | |
tree | 31c2f2ec34299e47c367836c5826b28a8086e43e | |
parent | 3342268ed2cd3d6a31d67ab2d727648af1de22e5 (diff) | |
download | justbuild-4c92586dad14eba9b9ea64cc8c6f68d6c59eed86.tar.gz |
Error reporting on action failure: give short target name
... as this is the only thing the user cares about when trying
to investigate why that action failed.
-rw-r--r-- | src/buildtool/execution_engine/executor/executor.hpp | 2 | ||||
-rw-r--r-- | test/end-to-end/actions/error-reporting.sh | 22 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index 53a0f6da..046a6a4c 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -618,7 +618,7 @@ class ExecutorImpl { msg << "\nrequested by"; for (auto const& origin : origins->second) { msg << "\n - "; - msg << origin.first.ToString(); + msg << origin.first.ToShortString(); msg << "#"; msg << origin.second; } diff --git a/test/end-to-end/actions/error-reporting.sh b/test/end-to-end/actions/error-reporting.sh index 7518fe53..8705e6ec 100644 --- a/test/end-to-end/actions/error-reporting.sh +++ b/test/end-to-end/actions/error-reporting.sh @@ -22,12 +22,22 @@ readonly JUST="${ROOT}/bin/tool-under-test" readonly LOCAL_TOOLS="${TMPDIR}/tools" touch ROOT -cat > TARGETS <<EOF +cat > TARGETS <<'EOF' { "theTargetCausingTheFailure": { "type": "generic" + , "arguments_config": ["foo", "bar"] , "outs": ["a.txt"] , "cmds": - ["echo -n stdout-of-; echo failing-target", "touch a.txt", "exit 42"] + [ { "type": "join" + , "$1": + [ "echo -n stdout-of-; echo failing-target-" + , {"type": "var", "name": "foo", "default": ""} + , {"type": "var", "name": "bar", "default": ""} + ] + } + , "touch a.txt" + , "exit 42" + ] } } EOF @@ -39,6 +49,7 @@ echo mkdir -p "${OUT}" "${JUST}" build --local-build-root "${LBR}" \ -f "${OUT}/log" --log-limit 0 \ + -D '{"foo": "FOO", "irrelevant": "abc"}' \ 2>&1 && exit 1 || : # The exit code should be reported @@ -47,12 +58,17 @@ grep 42 "${OUT}/log" # The target name should be reported grep theTargetCausingTheFailure "${OUT}/log" +# The pruned effective configuration should be reported in canonical +# compact form. +grep '{"foo":"FOO"}' "${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"}' \ 2>&1 && exit 1 || : -grep stdout-of-failing-target "${OUT}/log.default" +grep stdout-of-failing-target-FOO "${OUT}/log.default" echo OK |