From f62c9a57d1f3536cb877d2bf8cb87d8a91a1a960 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 14 Jan 2025 12:02:06 +0100 Subject: Add basic end-to-end test for absent computed roots --- test/end-to-end/computed-roots/TARGETS | 16 ++++++ test/end-to-end/computed-roots/absent-computed.sh | 61 ++++++++++++++++++++++ .../computed-roots/targets.absent-targets | 8 +++ .../computed-roots/targets.absent-targets-data | 1 + 4 files changed, 86 insertions(+) create mode 100644 test/end-to-end/computed-roots/absent-computed.sh create mode 100644 test/end-to-end/computed-roots/targets.absent-targets create mode 100644 test/end-to-end/computed-roots/targets.absent-targets-data (limited to 'test') 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 <&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"]]}} -- cgit v1.2.3