summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-09-21 17:02:27 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-09-22 11:19:16 +0200
commit5706fabb8270910188d0234c693c20b8eb82223f (patch)
tree9f4234737ea1e19bdb6d81b1382479511e7c4f71
parentb2b13d99d72db589d2e17d658c358849d7153b2d (diff)
downloadjustbuild-5706fabb8270910188d0234c693c20b8eb82223f.tar.gz
Add regression test that --fetch-absent does not store a subtree
... as tree for the whole commit, and thus pollutes subsequent builds.
-rw-r--r--test/end-to-end/just-mr/fetch-absent.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/end-to-end/just-mr/fetch-absent.sh b/test/end-to-end/just-mr/fetch-absent.sh
index 2a753bc5..16f1877f 100644
--- a/test/end-to-end/just-mr/fetch-absent.sh
+++ b/test/end-to-end/just-mr/fetch-absent.sh
@@ -23,6 +23,7 @@ readonly JUST_MR="${PWD}/bin/mr-tool-under-test"
readonly LBR="${TEST_TMPDIR}/local-build-root"
readonly OUT="${TEST_TMPDIR}/out"
readonly OUT2="${TEST_TMPDIR}/out2"
+readonly OUT3="${TEST_TMPDIR}/out3"
mkdir work
cd work
@@ -75,4 +76,38 @@ grep 42 "${OUT}/out.txt"
--fetch-absent install -o "${OUT2}" 2>&1
grep 42 "${OUT2}/out.txt"
+# Now take the same repo, but without the subdir, to ensure we did not
+# cache a wrong association.
+cat > repos.json <<EOF
+{ "repositories":
+ { "":
+ { "repository":
+ { "type": "git"
+ , "commit": "$COMMIT_0"
+ , "pragma": {"absent": true}
+ , "repository": "http://non-existent.example.org/data.git"
+ , "branch": "master"
+ }
+ , "target_root": "targets"
+ }
+ , "targets": {"repository": {"type": "file", "path": "targets"}}
+ }
+}
+EOF
+cat > targets/TARGETS <<'EOF'
+{ "":
+ { "type": "generic"
+ , "outs": ["out.txt"]
+ , "cmds": ["head -c 1 src/4.txt > out.txt", "cat src/2.txt >> out.txt"]
+ , "deps": ["src/4.txt", "src/2.txt"]
+ }
+}
+EOF
+"${JUST_MR}" --norc --local-build-root "${LBR}" \
+ --remote-serve-address ${SERVE} \
+ -r ${REMOTE_EXECUTION_ADDRESS} \
+ --just "${JUST}" \
+ --fetch-absent install -o "${OUT3}" 2>&1
+grep 42 "${OUT3}/out.txt"
+
echo DONE