summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-12-10 10:25:24 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-12-10 16:25:00 +0100
commitdc18781e01d64d2808ad93839e117730b7ca0354 (patch)
tree3b1f1fed04c381f2e5d048fe2944d8c21bacb630 /test
parentfe6939e9ef24ab52eb57c745eb106204c1acc576 (diff)
downloadjustbuild-dc18781e01d64d2808ad93839e117730b7ca0354.tar.gz
Add a test building against computed roots with absent base repository
Diffstat (limited to 'test')
-rw-r--r--test/end-to-end/computed-roots/TARGETS12
-rw-r--r--test/end-to-end/computed-roots/absent-base.sh73
-rw-r--r--test/end-to-end/computed-roots/targets.absent-base20
3 files changed, 104 insertions, 1 deletions
diff --git a/test/end-to-end/computed-roots/TARGETS b/test/end-to-end/computed-roots/TARGETS
index 5a1c6762..8abea7d7 100644
--- a/test/end-to-end/computed-roots/TARGETS
+++ b/test/end-to-end/computed-roots/TARGETS
@@ -53,11 +53,21 @@
, "test": ["artifacts-only.sh"]
, "deps": [["", "tool-under-test"]]
}
+, "absent base of root (data)":
+ {"type": "install", "files": {"TARGETS": "targets.absent-base"}}
+, "absent base of root":
+ { "type": ["end-to-end", "with serve"]
+ , "name": ["absent-base"]
+ , "test": ["absent-base.sh"]
+ , "deps": [["", "tool-under-test"]]
+ , "repos": ["absent base of root (data)"]
+ }
, "TESTS":
{ "type": ["@", "rules", "test", "suite"]
, "stage": ["computed-roots"]
, "deps":
- [ "artifacts-only"
+ [ "absent base of root"
+ , "artifacts-only"
, "basic"
, "basic remote build"
, "error-reporting"
diff --git a/test/end-to-end/computed-roots/absent-base.sh b/test/end-to-end/computed-roots/absent-base.sh
new file mode 100644
index 00000000..1be9e901
--- /dev/null
+++ b/test/end-to-end/computed-roots/absent-base.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+# Copyright 2024 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
+
+env
+
+readonly ROOT="${PWD}"
+readonly JUST="${ROOT}/bin/tool-under-test"
+readonly LBR="${TEST_TMPDIR}/local-build-root"
+readonly MAIN="${ROOT}/main"
+readonly OUT="${TEST_TMPDIR}/out"
+
+COMPAT=""
+if [ "${COMPATIBLE:-}" = "YES" ]; then
+ COMPAT="--compatible"
+fi
+
+
+mkdir -p "${MAIN}"
+cd "${MAIN}"
+
+cat > repo-config.json <<EOF
+{ "repositories":
+ { "base": {"workspace_root": ["git tree", "${TREE_0}"]}
+ , "":
+ { "workspace_root": ["computed", "base", "", "", {"COUNT": "10"}]
+ , "target_root": ["file", "${MAIN}/targets"]
+ }
+ }
+}
+EOF
+cat repo-config.json
+
+mkdir -p targets
+cat > targets/TARGETS <<'EOF'
+{ "":
+ { "type": "generic"
+ , "outs": ["out"]
+ , "cmds": ["cat *.txt > out"]
+ , "deps": [["data", ""]]
+ }
+}
+EOF
+mkdir -p targets/data
+cat > targets/data/TARGETS <<'EOF'
+{"": {"type": "install", "deps": [["GLOB", null, "*.txt"]]}}
+EOF
+
+echo
+echo Build against computed root with absent base
+echo
+"${JUST}" install -o "${OUT}" -C repo-config.json \
+ --local-build-root "${LBR}" \
+ --remote-serve-address ${SERVE} \
+ -r ${REMOTE_EXECUTION_ADDRESS} ${COMPAT} \
+ --log-limit 4 2>&1
+# sanity check output
+[ $(cat "${OUT}/out" | wc -l) -eq 55 ]
+
+echo OK
diff --git a/test/end-to-end/computed-roots/targets.absent-base b/test/end-to-end/computed-roots/targets.absent-base
new file mode 100644
index 00000000..f87157cb
--- /dev/null
+++ b/test/end-to-end/computed-roots/targets.absent-base
@@ -0,0 +1,20 @@
+{ "": {"type": "export", "target": "data", "flexible_config": ["COUNT"]}
+, "data":
+ { "type": "generic"
+ , "arguments_config": ["COUNT"]
+ , "out_dirs": ["data"]
+ , "cmds":
+ [ { "type": "join"
+ , "$1":
+ [ "COUNT="
+ , {"type": "join_cmd", "$1": [{"type": "var", "name": "COUNT"}]}
+ ]
+ }
+ , "mkdir -p data"
+ , "for i in `seq 1 $COUNT`"
+ , "do"
+ , " seq 1 $i > data/count$i.txt"
+ , "done"
+ ]
+ }
+}