From b9d3b2ef9e79878c422433c0289a2613fee11001 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 1 Feb 2024 10:47:05 +0100 Subject: Add end-to-end test describing absent export targets --- test/end-to-end/serve-service/TARGETS | 19 ++++++ test/end-to-end/serve-service/data/ROOT | 0 .../serve-service/data/targets/TARGETS.describe | 27 ++++++++ test/end-to-end/serve-service/describe.sh | 75 ++++++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 test/end-to-end/serve-service/data/ROOT create mode 100644 test/end-to-end/serve-service/data/targets/TARGETS.describe create mode 100644 test/end-to-end/serve-service/describe.sh (limited to 'test') diff --git a/test/end-to-end/serve-service/TARGETS b/test/end-to-end/serve-service/TARGETS index c8d6ca70..47424d71 100644 --- a/test/end-to-end/serve-service/TARGETS +++ b/test/end-to-end/serve-service/TARGETS @@ -95,6 +95,24 @@ , "deps": [["end-to-end", "mr-tool-under-test"], ["end-to-end", "tool-under-test"]] } +, "describe (data)": + { "type": "install" + , "files": {"ROOT": "data/ROOT", "TARGETS": "data/targets/TARGETS.describe"} + } +, "describe (locally installed)": + {"type": "install", "dirs": [["describe (data)", "repo"]]} +, "describe": + { "type": ["end-to-end", "with serve"] + , "name": ["describe"] + , "test": ["describe.sh"] + , "deps": + [ ["end-to-end", "mr-tool-under-test"] + , ["end-to-end", "tool-under-test"] + , "describe (locally installed)" + ] + , "repos": ["describe (data)"] + , "keep": ["out/describe.orig", "out/describe"] + } , "TESTS": { "type": "install" , "tainted": ["test"] @@ -109,6 +127,7 @@ , "serve-start-execute-sharding" , "serve-export-deps" , "serve-query-target-cache-value" + , "describe" ] , { "type": "if" , "cond": {"type": "var", "name": "TEST_COMPATIBLE_REMOTE"} diff --git a/test/end-to-end/serve-service/data/ROOT b/test/end-to-end/serve-service/data/ROOT new file mode 100644 index 00000000..e69de29b diff --git a/test/end-to-end/serve-service/data/targets/TARGETS.describe b/test/end-to-end/serve-service/data/targets/TARGETS.describe new file mode 100644 index 00000000..eb3f9bb2 --- /dev/null +++ b/test/end-to-end/serve-service/data/targets/TARGETS.describe @@ -0,0 +1,27 @@ +{ "": + { "type": "export" + , "target": "_" + , "doc": ["A glorified hello-world example"] + , "flexible_config": ["NAME"] + , "config_doc": {"NAME": ["The name to say hello to"]} + } +, "_": + { "type": "generic" + , "arguments_config": ["NAME"] + , "outs": ["greeting.txt"] + , "cmds": + [ { "type": "join" + , "$1": + [ { "type": "join_cmd" + , "$1": + [ "echo" + , "Hello" + , {"type": "var", "name": "NAME", "default": "world"} + ] + } + , " > greeting.txt" + ] + } + ] + } +} diff --git a/test/end-to-end/serve-service/describe.sh b/test/end-to-end/serve-service/describe.sh new file mode 100644 index 00000000..f731ce8c --- /dev/null +++ b/test/end-to-end/serve-service/describe.sh @@ -0,0 +1,75 @@ +#!/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 + +readonly JUST="${PWD}/bin/tool-under-test" +readonly JUST_MR="${PWD}/bin/mr-tool-under-test" +readonly LBR1="${TEST_TMPDIR}/local-build-root-1" +readonly LBR2="${TEST_TMPDIR}/local-build-root-1" +readonly OUT="${PWD}/out" +mkdir -p "${OUT}" + +COMPAT="" +if [ "${COMPATIBLE:-}" = "YES" ]; then + COMPAT="--compatible" +fi + +echo Local description +echo +(cd repo \ + && "${JUST}" describe --local-build-root "${LBR1}" > "${OUT}/describe.orig") +cat "${OUT}/describe.orig" +echo + +mkdir work +cd work +touch ROOT + +cat > repos.json < "${OUT}/describe" +cat "${OUT}/describe" +echo + +diff -u "${OUT}/describe.orig" "${OUT}/describe" + + +echo OK -- cgit v1.2.3