From a1b45eef0a50da931a2c46fe842631d27ca4be56 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 9 Sep 2024 15:09:45 +0200 Subject: test stage-links: Check also actions with non-contained symlinks --- test/end-to-end/symlinks/stage-links.sh | 78 ++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/end-to-end/symlinks/stage-links.sh b/test/end-to-end/symlinks/stage-links.sh index 25c9d15e..b8173105 100644 --- a/test/end-to-end/symlinks/stage-links.sh +++ b/test/end-to-end/symlinks/stage-links.sh @@ -16,15 +16,17 @@ set -eu readonly JUST="${PWD}/bin/tool-under-test" +readonly OUT="${TMPDIR}/out" +mkdir -p "${OUT}" touch ROOT cat > TARGETS < TARGETS <&1 +${JUST} install -L '["env", "PATH='"${PATH}"'"]' ${ARGS} input-non-upwards \ + -o "${OUT}" 2>&1 && ls -alR "${OUT}" && rm -rf "${OUT}/*" || FAILED=YES + +echo +echo "test input non-upwards remotely" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} input-non-upwards 2>&1 +${JUST} install -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} input-non-upwards \ + -o "${OUT}" 2>&1 && ls -alR "${OUT}" && rm -rf "${OUT}/*" || FAILED=YES + +echo +echo "test staging non-upwards locally" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} stage-non-upwards-links 2>&1 || FAILED=YES + +echo +echo "test staging non-upwards remotely" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} stage-non-upwards-links 2>&1 || FAILED=YES + +# Check that actions with non-contained upwards symlinks fail +echo +echo "test input non-contained locally" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} input-non-contained 2>&1 \ + && echo "this should have failed" && FAILED=YES +${JUST} install -L '["env", "PATH='"${PATH}"'"]' ${ARGS} input-non-contained -o "${OUT}" 2>&1 \ + && echo "this should have failed" && FAILED=YES \ + && ls -alR "${OUT}" && rm -rf "${OUT}/*" || echo "failed as expected" + +echo +echo "test input non-contained remotely" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} input-non-contained 2>&1 \ + && echo "this should have failed" && FAILED=YES || echo "failed as expected" +${JUST} install -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} input-non-contained -o "${OUT}" 2>&1 \ + && echo "this should have failed" && FAILED=YES \ + && ls -alR "${OUT}" && rm -rf "${OUT}/*" || echo "failed as expected" + +echo +echo "test staging non-contained locally" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} stage-non-contained-links 2>&1 \ + && echo "this should have failed" && FAILED=YES || echo "failed as expected" + +echo +echo "test staging non-contained remotely" +${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} stage-non-contained-links 2>&1 \ + && echo "this should have failed" && FAILED=YES || echo "failed as expected" + +if [ ! -z "${FAILED}" ]; then + exit 1 +fi -echo "test staging remotely" -${JUST} build -L '["env", "PATH='"${PATH}"'"]' ${ARGS} ${REMOTE_EXECUTION_ARGS} stage-links +echo +echo OK -- cgit v1.2.3