diff options
4 files changed, 86 insertions, 0 deletions
diff --git a/test/end-to-end/computed-roots/TARGETS b/test/end-to-end/computed-roots/TARGETS index 14e9a5e5..2963b5e2 100644 --- a/test/end-to-end/computed-roots/TARGETS +++ b/test/end-to-end/computed-roots/TARGETS @@ -82,11 +82,27 @@ , "deps": [["", "tool-under-test"]] , "repos": ["absent base of root (data)"] } +, "absent target root (data)": + { "type": "install" + , "files": + { "TARGETS": "targets.absent-targets" + , "data/TARGETS": "targets.absent-targets-data" + } + } +, "absent computed root": + { "type": ["end-to-end", "with serve"] + , "name": ["absent-computed"] + , "test": ["absent-computed.sh"] + , "deps": [["", "tool-under-test"]] + , "repos": ["absent base of root (data)", "absent target root (data)"] + , "keep": ["out/build.log"] + } , "TESTS": { "type": ["@", "rules", "test", "suite"] , "stage": ["computed-roots"] , "deps": [ "absent base of root" + , "absent computed root" , "artifacts-only" , "basic" , "basic remote build" diff --git a/test/end-to-end/computed-roots/absent-computed.sh b/test/end-to-end/computed-roots/absent-computed.sh new file mode 100644 index 00000000..0e84c905 --- /dev/null +++ b/test/end-to-end/computed-roots/absent-computed.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# Copyright 2025 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 TARGETS="${ROOT}/targets" +readonly OUT="${TEST_TMPDIR}/out" +readonly LOG="${TEST_TMPDIR}/overall.log" +readonly BUILD_LOG="${OUT}/build.log" + +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"}, {"absent": true}] + , "target_root": ["git tree", "${TREE_1}"] + } + } +} +EOF +cat repo-config.json + +echo +echo Build against absent 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 -f "${LOG}" 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-targets b/test/end-to-end/computed-roots/targets.absent-targets new file mode 100644 index 00000000..b1c27550 --- /dev/null +++ b/test/end-to-end/computed-roots/targets.absent-targets @@ -0,0 +1,8 @@ +{ "cat": + { "type": "generic" + , "outs": ["out"] + , "cmds": ["cat *.txt > out"] + , "deps": [["data", ""]] + } +, "": {"type": "export", "target": "cat"} +} diff --git a/test/end-to-end/computed-roots/targets.absent-targets-data b/test/end-to-end/computed-roots/targets.absent-targets-data new file mode 100644 index 00000000..69dd913d --- /dev/null +++ b/test/end-to-end/computed-roots/targets.absent-targets-data @@ -0,0 +1 @@ +{"": {"type": "install", "deps": [["GLOB", null, "*.txt"]]}} |