diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-01-09 10:14:09 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-01-09 11:23:42 +0100 |
commit | 1ab9c8fafb5a05299649891b0f5f24e8be59dc8f (patch) | |
tree | 78c82013747c1ac5f4b0787f22266c55e27c5565 /test/end-to-end | |
parent | 22ef0a1617fcfaf3e89407b6b9c50b46a04ac8a7 (diff) | |
download | justbuild-1ab9c8fafb5a05299649891b0f5f24e8be59dc8f.tar.gz |
Test deduplication of "tree structure" roots
Diffstat (limited to 'test/end-to-end')
-rw-r--r-- | test/end-to-end/git-import/TARGETS | 1 | ||||
-rw-r--r-- | test/end-to-end/git-import/tree_structure.sh | 29 |
2 files changed, 28 insertions, 2 deletions
diff --git a/test/end-to-end/git-import/TARGETS b/test/end-to-end/git-import/TARGETS index 4f59b834..8359aaea 100644 --- a/test/end-to-end/git-import/TARGETS +++ b/test/end-to-end/git-import/TARGETS @@ -62,6 +62,7 @@ , "deps": [ ["", "mr-tool-under-test"] , ["", "tool-under-test"] + , ["end-to-end", "deduplicate-tool-under-test"] , ["end-to-end", "git-import-under-test"] ] } diff --git a/test/end-to-end/git-import/tree_structure.sh b/test/end-to-end/git-import/tree_structure.sh index 078ea0b7..dc1a27e2 100644 --- a/test/end-to-end/git-import/tree_structure.sh +++ b/test/end-to-end/git-import/tree_structure.sh @@ -16,6 +16,7 @@ set -e readonly ROOT="${PWD}" +readonly DEDUPLICATE="${ROOT}/bin/deduplicate-tool-under-test" readonly GIT_IMPORT="${ROOT}/bin/git-import-under-test" readonly JUST="${ROOT}/bin/tool-under-test" readonly JUST_MR="${ROOT}/bin/mr-tool-under-test" @@ -201,11 +202,35 @@ cat repos.template.json echo repos-full.json cat repos-full.json -# Check the result can be built after imports: +# Dump the graph before deduplication: echo "${JUST_MR}" -C repos-full.json --norc --just "${JUST}" \ + --local-build-root "${LBR}" --main "result" analyse \ + -L '["env", "PATH='"${PATH}"'"]' \ + --dump-plain-graph actions-full.json 2>&1 + +# Run deduplication: +echo +cat repos-full.json | "${DEDUPLICATE}" 2>&1 > repos.json +cat repos.json +echo + +# Dump the graph after deduplication: +"${JUST_MR}" -C repos.json --norc --just "${JUST}" \ + --local-build-root "${LBR}" --main "result" analyse \ + -L '["env", "PATH='"${PATH}"'"]' \ + --dump-plain-graph actions.json 2>&1 + +# Verify that we reduced the number of repositories, but did +# not change the action graph (except for the origins of the actions). +[ $(jq -aM '.repositories | length' repos.json) -lt $(jq -aM '.repositories | length' repos-full.json) ] +cmp actions-full.json actions.json + +# Check the result can be built after deduplication: +echo +"${JUST_MR}" -C repos.json --norc --just "${JUST}" \ --local-build-root "${LBR}" --main "result" \ install -L '["env", "PATH='"${PATH}"'"]' \ - -o "${OUT}/result-full" 2>&1 + -o "${OUT}/result" 2>&1 echo OK |