summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/end-to-end/just-mr/install-roots.sh42
-rw-r--r--test/end-to-end/remote-execution/install.sh21
-rw-r--r--test/end-to-end/remote-execution/upload-test.sh40
3 files changed, 92 insertions, 11 deletions
diff --git a/test/end-to-end/just-mr/install-roots.sh b/test/end-to-end/just-mr/install-roots.sh
index 1df1c1ba..368e505a 100644
--- a/test/end-to-end/just-mr/install-roots.sh
+++ b/test/end-to-end/just-mr/install-roots.sh
@@ -20,10 +20,12 @@ readonly JUST="${PWD}/bin/tool-under-test"
readonly JUST_MR="${PWD}/bin/mr-tool-under-test"
readonly DISTDIR="${TEST_TMPDIR}/distfiles"
readonly LBR="${TEST_TMPDIR}/local-build-root"
-readonly INSTALL_DIR="${TEST_TMPDIR}/installation-target"
+readonly INSTALL_DIR_1="${TEST_TMPDIR}/installation-target-1"
+readonly INSTALL_DIR_2="${TEST_TMPDIR}/installation-target-2"
readonly TEST_DATA="The content of the data file in foo"
readonly TEST_PATH="bar/baz"
+readonly LINK_TARGET="dummy"
mkdir -p "${DISTDIR}"
@@ -31,6 +33,7 @@ mkdir -p "${DISTDIR}"
mkdir -p "foo/${TEST_PATH}"
echo {} > foo/TARGETS
echo -n "${TEST_DATA}" > "foo/${TEST_PATH}/data.txt"
+ln -s "${LINK_TARGET}" "foo/${TEST_PATH}/link"
tar cf "${DISTDIR}/foo-1.2.3.tar" foo 2>&1
foocontent=$(git hash-object "${DISTDIR}/foo-1.2.3.tar")
echo "Foo archive has content ${foocontent}"
@@ -48,25 +51,52 @@ cat > repos.json <<EOF
, "subdir": "foo"
}
}
+ , "foo_ignore_special":
+ { "repository":
+ { "type": "archive"
+ , "ignore_special": true
+ , "content": "${foocontent}"
+ , "fetch": "http://non-existent.example.org/foo-1.2.3.tar"
+ , "subdir": "foo"
+ }
+ }
, "":
{ "repository": {"type": "file", "path": "."}
- , "bindings": {"foo": "foo"}
+ , "bindings": {"foo": "foo", "foo_ignore_special": "foo_ignore_special"}
}
}
}
EOF
-# Compute the repository configuration and read of tree from there
+# Compute the repository configuration
CONF=$("${JUST_MR}" --norc --local-build-root "${LBR}" --distdir "${DISTDIR}" setup)
cat "${CONF}"
echo
+
+echo === regular root ===
+
+# Read tree from repository configuration
TREE=$(jq -r '.repositories.foo.workspace_root[1]' "${CONF}")
echo Tree is "${TREE}"
-# As the tree is kown to just (in the git CAS), we should be able to install
+# As the tree is known to just (in the git CAS), we should be able to install
+# it with install-cas
+"${JUST}" install-cas --local-build-root "${LBR}" -o "${INSTALL_DIR_1}" \
+ "${TREE}::t" 2>&1
+test "$(cat "${INSTALL_DIR_1}/${TEST_PATH}/data.txt")" = "${TEST_DATA}"
+test "$(readlink "${INSTALL_DIR_1}/${TEST_PATH}/link")" = "${LINK_TARGET}"
+
+echo === ignore_special root ===
+
+# Read tree from repository configuration
+TREE=$(jq -r '.repositories.foo_ignore_special.workspace_root[1]' "${CONF}")
+echo Tree is "${TREE}"
+
+# As the tree is known to just (in the git CAS), we should be able to install
# it with install-cas
-"${JUST}" install-cas --local-build-root "${LBR}" -o "${INSTALL_DIR}" \
+"${JUST}" install-cas --local-build-root "${LBR}" -o "${INSTALL_DIR_2}" \
"${TREE}::t" 2>&1
-test "$(cat "${INSTALL_DIR}/${TEST_PATH}/data.txt")" = "${TEST_DATA}"
+test "$(cat "${INSTALL_DIR_2}/${TEST_PATH}/data.txt")" = "${TEST_DATA}"
+[ ! -e "${INSTALL_DIR_2}/${TEST_PATH}/link" ] # symlink should be missing
echo OK
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 <<EOF
{ "repositories":
{"": {"workspace_root": ["git tree", "${TREE}", "${GITDIR}"]}}
@@ -54,7 +59,32 @@ fi
# Build locally
export CONF="$(realpath repos.json)"
-"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} 2>&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 <<EOF
+{ "repositories":
+ {"": {"workspace_root": ["git tree ignore-special", "${TREE}", "${GITDIR}"]}}
+}
+EOF
+
+ARGS=""
+if [ "${COMPATIBLE:-}" = "YES" ]; then
+ ARGS="--compatible"
+fi
+
+# Build locally
+export CONF="$(realpath repos.json)"
+"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR_2}" ${ARGS} 2>&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