summaryrefslogtreecommitdiff
path: root/test/end-to-end/symlinks
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2023-07-21 11:26:52 +0200
committerAlberto Sartori <alberto.sartori@huawei.com>2023-07-21 14:08:29 +0200
commit629dc072c7c81693e55cafaa90e63ff1128b0efe (patch)
tree54960c37839b1ef388d50444414795d78298a6c2 /test/end-to-end/symlinks
parent5548997571612cb8a78dfa9ac50ed690a28341ca (diff)
downloadjustbuild-629dc072c7c81693e55cafaa90e63ff1128b0efe.tar.gz
bugfix: stage symlinks as symlinks when creating an action directory
Before this patch, when creating an action directory, symlinks were staged as regular files.
Diffstat (limited to 'test/end-to-end/symlinks')
-rw-r--r--test/end-to-end/symlinks/TARGETS8
-rw-r--r--test/end-to-end/symlinks/stage-links.sh55
2 files changed, 63 insertions, 0 deletions
diff --git a/test/end-to-end/symlinks/TARGETS b/test/end-to-end/symlinks/TARGETS
new file mode 100644
index 00000000..12add451
--- /dev/null
+++ b/test/end-to-end/symlinks/TARGETS
@@ -0,0 +1,8 @@
+{ "stage-links":
+ { "type": ["end-to-end", "with remote"]
+ , "name": ["stage-links"]
+ , "test": ["stage-links.sh"]
+ , "deps": [["end-to-end", "tool-under-test"]]
+ }
+, "TESTS": {"type": "install", "tainted": ["test"], "deps": ["stage-links"]}
+}
diff --git a/test/end-to-end/symlinks/stage-links.sh b/test/end-to-end/symlinks/stage-links.sh
new file mode 100644
index 00000000..b8234d2a
--- /dev/null
+++ b/test/end-to-end/symlinks/stage-links.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Copyright 2023 Huawei Cloud Computing Technology Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -eu
+
+readonly JUST="${PWD}/bin/tool-under-test"
+
+touch ROOT
+cat > TARGETS <<EOF
+{ "input":
+ { "type": "generic"
+ , "out_dirs": ["."]
+ , "cmds": ["touch foo", "ln -s foo bar", "ln -s iNeXIstENt baz"]
+ }
+, "stage-links":
+ { "type": "generic"
+ , "out_dirs": ["."]
+ , "cmds":
+ [ "test -L bar || (printf \"\n\nwrong staging: bar must be a symlink\n\n\" && exit 1)"
+ , "test -L baz || (printf \"\n\nwrong staging: baz must be a symlink\n\n\" && exit 1)"
+ , "! test -e iNeXIstENt"
+ ]
+ , "deps": ["input"]
+ }
+}
+EOF
+
+ARGS="--local-build-root=.root"
+if [ "${COMPATIBLE:-}" = "YES" ]; then
+ NAME="compatible"
+ ARGS="$ARGS --compatible"
+fi
+
+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
+
+echo "test staging locally"
+${JUST} build ${ARGS} stage-links
+
+echo "test staging remotely"
+${JUST} build ${ARGS} ${REMOTE_EXECUTION_ARGS} stage-links