From 28596730eb3ef6231537d702ea16e54d144459bc Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 3 Nov 2023 17:09:34 +0100 Subject: test: Verify unlink of symlinks --- test/end-to-end/cli/install.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/end-to-end/cli') diff --git a/test/end-to-end/cli/install.sh b/test/end-to-end/cli/install.sh index ee2eb271..1e64b347 100644 --- a/test/end-to-end/cli/install.sh +++ b/test/end-to-end/cli/install.sh @@ -27,6 +27,11 @@ cat > src/TARGETS <<'EOF' , "outs": ["hello.txt"] , "cmds": ["echo Hello World > hello.txt"] } +, "symlink": + { "type": "generic" + , "outs": ["hello.txt", "content.txt"] + , "cmds": ["echo Hello World > content.txt", "ln -s content.txt hello.txt"] + } } EOF SRCDIR=$(realpath src) @@ -66,4 +71,28 @@ cd "${OUTDIR}" grep World "${ID}" grep Original unrelated.txt +# Verify non-interference of install symlinks (overwrite existing file) +cd "${SRCDIR}" +"${TOOL}" install --local-build-root "${BUILDROOT}" -o "${OUTDIR}" symlink 2>&1 + +echo +ls -al "${OUTDIR}" +cd "${OUTDIR}" +grep World hello.txt +grep Original unrelated.txt +[ "$(realpath --relative-to=$(pwd) hello.txt)" = "content.txt" ] + +# Verify non-interference of install symlinks (overwrite existing symlink) +rm -f ${OUTDIR}/hello.txt +ln -s /noexistent ${OUTDIR}/hello.txt +cd "${SRCDIR}" +"${TOOL}" install --local-build-root "${BUILDROOT}" -o "${OUTDIR}" symlink 2>&1 + +echo +ls -al "${OUTDIR}" +cd "${OUTDIR}" +grep World hello.txt +grep Original unrelated.txt +[ "$(realpath --relative-to=$(pwd) hello.txt)" = "content.txt" ] + echo OK -- cgit v1.2.3