summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2024-02-26 16:31:00 +0100
committerAlberto Sartori <alberto.sartori@huawei.com>2024-04-24 12:58:10 +0200
commitf7f2f0dc41b75b5f2a094d33e6325fdf9e8438a8 (patch)
tree80d23e32f6634279ea6f516f1592da9952cdf650 /test
parent4ea9f8f7f3367bed309c6e3f84bed541d73929e8 (diff)
downloadjustbuild-f7f2f0dc41b75b5f2a094d33e6325fdf9e8438a8.tar.gz
just analyse: add --dump-result command line option
The result of the analysis is a JSON object containing the keys `"artifacts"`, `"runfiles"`, and `"provides"`. This JSON object, by default, is logged. However, it might be useful to process the data contained in it, while, for example, developing new rules. This patch adds a new command line option (`--dump-result`), reserved to the subcommand `analyse`, to dump the analysis result to the given file or stdout (if `-` is given).
Diffstat (limited to 'test')
-rwxr-xr-xtest/end-to-end/cli/analyse.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/end-to-end/cli/analyse.sh b/test/end-to-end/cli/analyse.sh
index 69ffd4b8..b09a3ac8 100755
--- a/test/end-to-end/cli/analyse.sh
+++ b/test/end-to-end/cli/analyse.sh
@@ -49,6 +49,12 @@ cat > TARGETS <<'EOF'
{"provides": {"type": "provides"}}
EOF
+"${TOOL}" analyse --local-build-root "${BUILDROOT}" \
+ --dump-result "${OUT}/result.json" 2>&1
+cat "${OUT}/result.json"
+[ "$(jq 'has("artifacts")' "${OUT}/result.json")" = true ]
+[ "$(jq 'has("provides")' "${OUT}/result.json")" = true ]
+[ "$(jq 'has("runfiles")' "${OUT}/result.json")" = true ]
"${TOOL}" analyse --local-build-root "${BUILDROOT}" \
--dump-provides "${OUT}/plain.json" 2>&1