diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-03-24 10:00:30 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-03-24 10:47:18 +0100 |
commit | eb291b9ebe3252c2113501a8829d2da2d41205b2 (patch) | |
tree | 0ac6fddaafe304e2b782e49805c65b1c50424915 /test | |
parent | baa9fca6c850f9fdb3afa6dc43b624b54add7011 (diff) | |
download | justbuild-eb291b9ebe3252c2113501a8829d2da2d41205b2.tar.gz |
Extend install test to also verify the --remember option
Diffstat (limited to 'test')
-rw-r--r-- | test/end-to-end/remote-execution/install.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/end-to-end/remote-execution/install.sh b/test/end-to-end/remote-execution/install.sh index be77da95..559b1a5b 100644 --- a/test/end-to-end/remote-execution/install.sh +++ b/test/end-to-end/remote-execution/install.sh @@ -20,9 +20,12 @@ readonly JUST="${PWD}/bin/tool-under-test" readonly WRKDIR="${PWD}" readonly LBRDIR_A="${TEST_TMPDIR}/local-build-root/instance-A" readonly LBRDIR_B="${TEST_TMPDIR}/local-build-root/instance-B" +readonly LBRDIR_C="${TEST_TMPDIR}/local-build-root/instance-C" readonly SRCDIR_A="${TEST_TMPDIR}/src/instance-A" readonly SRCDIR_B="${TEST_TMPDIR}/src/instance-B" +readonly SRCDIR_C="${TEST_TMPDIR}/src/instance-C" readonly OUTDIR_B="${TEST_TMPDIR}/out/instance-B" +readonly OUTDIR_C="${TEST_TMPDIR}/out/instance-C" REMOTE_EXECUTION_ARGS="-r ${REMOTE_EXECUTION_ADDRESS}" LOCAL_ARGS="" @@ -67,6 +70,20 @@ do cmp "${SRCDIR_A}/tree/$f" "${OUTDIR_B}/first/$f" done +## ... and to remember + +"${JUST}" install-cas --local-build-root "${LBRDIR_B}" \ + -o "${OUTDIR_B}/first-discard" \ + --remember ${REMOTE_EXECUTION_ARGS} "${TREE_ID}" 2>&1 + +"${JUST}" install-cas --local-build-root "${LBRDIR_B}" \ + -o "${OUTDIR_B}/first-from-local" ${LOCAL_ARGS} "${TREE_ID}" 2>&1 +for f in $(cd "${SRCDIR_A}/tree" && find . -type f) +do + cmp "${SRCDIR_A}/tree/$f" "${OUTDIR_B}/first-from-local/$f" +done + + # install-cas has to prefer (at least: use) local CAS, also with remote endpoint ## instance B builds locally, to fill local CAS @@ -100,4 +117,42 @@ do cmp "${SRCDIR_B}/tree/$f" "${OUTDIR_B}/second/$f" done +# install --remember + +## install a tree with --remember + +mkdir -p "${SRCDIR_C}" +cd "${SRCDIR_C}" +touch ROOT + +cat > TARGETS <<'EOF' +{ "": + { "type": "generic" + , "out_dirs": ["out"] + , "cmds": + [ "mkdir -p out/foo out/bar out/baz" + , "echo some file content > out/foo/data.txt" + , "echo more file content > out/bar/file.txt" + , "echo even more file content > out/bar/another_file.txt" + ] + } +} +EOF + +"${JUST}" install --local-build-root "${LBRDIR_C}" \ + --remember -o "${OUTDIR_C}/remote" \ + --dump-artifacts "${WRKDIR}/tree.json" ${REMOTE_EXECUTION_ARGS} 2>&1 + +## now it should also be available for local installation + +TREE_ID=$(jq -r ".\"${OUTDIR_C}/remote/out\".id" "${WRKDIR}/tree.json")"::t" +"${JUST}" install-cas --local-build-root "${LBRDIR_C}" \ + -o "${OUTDIR_C}/local" \ + ${LOCAL_ARGS} "${TREE_ID}" 2>&1 + +for f in $(cd "${OUTDIR_C}/remote/out" && find . -type f) +do + cmp "${OUTDIR_C}/remote/out/$f" "${OUTDIR_C}/local/$f" +done + echo OK |