summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-09-28 16:40:33 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-02 12:06:50 +0100
commit56303e02881731a88eaae6324c0215fece9baabe (patch)
treef56c5c35917a88b41aa0151dc32d691d3a8513b3 /test
parentc215468b5a496feaf38ecd44f3a3302f7f40b427 (diff)
downloadjustbuild-56303e02881731a88eaae6324c0215fece9baabe.tar.gz
just-mr fetch: Add handling of --fetch-absent option
Diffstat (limited to 'test')
-rw-r--r--test/end-to-end/just-mr/fetch.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/end-to-end/just-mr/fetch.sh b/test/end-to-end/just-mr/fetch.sh
index 323db6d1..c216fd1c 100644
--- a/test/end-to-end/just-mr/fetch.sh
+++ b/test/end-to-end/just-mr/fetch.sh
@@ -73,4 +73,46 @@ newfoocontent=$(git hash-object "${DISTDIR}/foo-1.2.3.tar")
echo "Foo archive has now content ${newfoocontent}"
test "${newfoocontent}" = "${foocontent}"
+
+# Verify we can fetch the same archive if marked absent using --fetch-absent
+cat > repos.json <<EOF
+{ "repositories":
+ { "foo":
+ { "repository":
+ { "type": "archive"
+ , "content": "${foocontent}"
+ , "fetch": "http://non-existent.example.org/foo-1.2.3.tar"
+ , "subdir": "foo"
+ , "pragma": {"absent": true}
+ }
+ }
+ , "":
+ { "repository": {"type": "file", "path": "."}
+ , "bindings": {"foo": "foo"}
+ }
+ }
+}
+EOF
+echo "Repository configuration:"
+cat repos.json
+
+# Use clean build root
+rm -rf "${LBR}"
+
+# Call just-mr with distdir present, to make it aware of the file
+"${JUST_MR}" --norc --local-build-root "${LBR}" --distdir "${DISTDIR}" setup 2>&1
+
+# Remove distdir content
+rm -rf "${DISTDIR}"
+mkdir -p "${DISTDIR}"
+
+# Ask just-mr to fetch to the empty distdir
+"${JUST_MR}" --norc --local-build-root "${LBR}" --fetch-absent fetch -o "${DISTDIR}" 2>&1
+
+# Verify that the correct file is stored in the distdir
+test -f "${DISTDIR}/foo-1.2.3.tar"
+newfoocontent=$(git hash-object "${DISTDIR}/foo-1.2.3.tar")
+echo "Foo archive has now content ${newfoocontent}"
+test "${newfoocontent}" = "${foocontent}"
+
echo OK