From bec3322cfff305f13735c5f72febfd752b49fa10 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 5 Jul 2023 10:46:42 +0200 Subject: test: Extend coverage for symlinks and ignore_special roots --- test/end-to-end/remote-execution/install.sh | 21 +++++++++++++ test/end-to-end/remote-execution/upload-test.sh | 40 +++++++++++++++++++++---- 2 files changed, 56 insertions(+), 5 deletions(-) (limited to 'test/end-to-end/remote-execution') diff --git a/test/end-to-end/remote-execution/install.sh b/test/end-to-end/remote-execution/install.sh index 559b1a5b..29c74dfa 100644 --- a/test/end-to-end/remote-execution/install.sh +++ b/test/end-to-end/remote-execution/install.sh @@ -50,6 +50,7 @@ mkdir -p tree/foo/bar mkdir -p tree/baz echo content frist file > tree/foo/bar/data.txt echo content second file > tree/baz/data.txt +ln -s dummy tree/foo/link cat > TARGETS <<'EOF' {"": {"type": "install", "dirs": [[["TREE", null, "tree"], "."]]}} @@ -69,6 +70,10 @@ for f in $(cd "${SRCDIR_A}/tree" && find . -type f) do cmp "${SRCDIR_A}/tree/$f" "${OUTDIR_B}/first/$f" done +for l in $(cd "${SRCDIR_A}/tree" && find . -type L) +do + cmp $(readlink "${SRCDIR_A}/tree/$l") $(readlink "${OUTDIR_B}/first/$l") +done ## ... and to remember @@ -78,10 +83,15 @@ done "${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 +for l in $(cd "${SRCDIR_A}/tree" && find . -type L) +do + cmp $(readlink "${SRCDIR_A}/tree/$l") $(readlink "${OUTDIR_B}/first-from-local/$l") +done # install-cas has to prefer (at least: use) local CAS, also with remote endpoint @@ -95,8 +105,10 @@ touch ROOT mkdir -p tree/different/foobar mkdir -p tree/bar/other_dir +mkdir -p tree/another_dir echo some other content > tree/different/foobar/file.txt echo yet another content > tree/bar/other_dir/file.txt +ln -s dummy tree/another_dir/link cat > TARGETS <<'EOF' {"": {"type": "install", "dirs": [[["TREE", null, "tree"], "."]]}} @@ -116,6 +128,10 @@ for f in $(cd "${SRCDIR_B}/tree" && find . -type f) do cmp "${SRCDIR_B}/tree/$f" "${OUTDIR_B}/second/$f" done +for l in $(cd "${SRCDIR_B}/tree" && find . -type L) +do + cmp $(readlink "${SRCDIR_B}/tree/$l") $(readlink "${OUTDIR_B}/second/$l") +done # install --remember @@ -134,6 +150,7 @@ cat > TARGETS <<'EOF' , "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" + , "ln -s dummy out/baz/link" ] } } @@ -154,5 +171,9 @@ for f in $(cd "${OUTDIR_C}/remote/out" && find . -type f) do cmp "${OUTDIR_C}/remote/out/$f" "${OUTDIR_C}/local/$f" done +for l in $(cd "${OUTDIR_C}/remote/out" && find . -type L) +do + cmp $(readlink "${OUTDIR_C}/remote/out/$l") $(readlink "${OUTDIR_C}/local/$l") +done echo OK diff --git a/test/end-to-end/remote-execution/upload-test.sh b/test/end-to-end/remote-execution/upload-test.sh index 5ab88955..f4fbfac7 100644 --- a/test/end-to-end/remote-execution/upload-test.sh +++ b/test/end-to-end/remote-execution/upload-test.sh @@ -18,7 +18,8 @@ set -eu readonly JUST="${PWD}/bin/tool-under-test" readonly GITDIR="${TEST_TMPDIR}/src" -readonly LBRDIR="${TEST_TMPDIR}/local-build-root" +readonly LBRDIR_1="${TEST_TMPDIR}/local-build-root-1" +readonly LBRDIR_2="${TEST_TMPDIR}/local-build-root-2" mkdir -p ${GITDIR} cd ${GITDIR} @@ -27,11 +28,12 @@ git config user.name "Nobody" git config user.email "nobody@example.org" mkdir -p foo/bar/baz echo `hostname`.`date +%s`.$$ > foo/bar/baz/data.txt +ln -s dummy foo/bar/baz/link cat > TARGETS <<'EOF' { "": { "type": "generic" - , "outs": ["out.txt"] - , "cmds": ["find . > out.txt"] + , "outs": ["out.txt", "newlink"] + , "cmds": ["find . > out.txt", "ln -s dummy newlink"] , "deps": [["TREE", null, "."]] } } @@ -41,6 +43,9 @@ git commit -m 'Generated new data' readonly TREE=$(git log --pretty=%T) cd ${TEST_TMPDIR} + +echo === regular root === + cat > repos.json <&1 +"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR_1}" ${ARGS} 2>&1 + +# Build remotely +REMOTE_EXECUTION_ARGS="-r ${REMOTE_EXECUTION_ADDRESS}" +if [ "${REMOTE_EXECUTION_PROPERTIES:-}" != "" ]; then + REMOTE_EXECUTION_ARGS="${REMOTE_EXECUTION_ARGS} --remote-execution-property ${REMOTE_EXECUTION_PROPERTIES}" +fi + +"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR_1}" ${ARGS} ${REMOTE_EXECUTION_ARGS} 2>&1 + +echo === ignore_special root === + +cat > repos.json <&1 # Build remotely REMOTE_EXECUTION_ARGS="-r ${REMOTE_EXECUTION_ADDRESS}" @@ -62,4 +92,4 @@ if [ "${REMOTE_EXECUTION_PROPERTIES:-}" != "" ]; then REMOTE_EXECUTION_ARGS="${REMOTE_EXECUTION_ARGS} --remote-execution-property ${REMOTE_EXECUTION_PROPERTIES}" fi -"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} ${REMOTE_EXECUTION_ARGS} 2>&1 +"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR_2}" ${ARGS} ${REMOTE_EXECUTION_ARGS} 2>&1 -- cgit v1.2.3