diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-02-01 10:47:05 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-02-01 17:54:50 +0100 |
commit | b9d3b2ef9e79878c422433c0289a2613fee11001 (patch) | |
tree | 4ca1dbdfdeb02669784dcbbca61c609bb426a635 /test/end-to-end/serve-service | |
parent | cbc46ba428500ac514ae26d5d3c1da6c9cb3c521 (diff) | |
download | justbuild-b9d3b2ef9e79878c422433c0289a2613fee11001.tar.gz |
Add end-to-end test describing absent export targets
Diffstat (limited to 'test/end-to-end/serve-service')
-rw-r--r-- | test/end-to-end/serve-service/TARGETS | 19 | ||||
-rw-r--r-- | test/end-to-end/serve-service/data/ROOT | 0 | ||||
-rw-r--r-- | test/end-to-end/serve-service/data/targets/TARGETS.describe | 27 | ||||
-rw-r--r-- | test/end-to-end/serve-service/describe.sh | 75 |
4 files changed, 121 insertions, 0 deletions
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 --- /dev/null +++ b/test/end-to-end/serve-service/data/ROOT 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 <<EOF +{ "repositories": + { "": + { "repository": + { "type": "git" + , "commit": "$COMMIT_0" + , "pragma": {"absent": true} + , "repository": "http://non-existent.example.org/data.git" + , "branch": "master" + , "subdir": "." + } + } + } +} +EOF + +echo Repo config +echo +cat repos.json +echo + +echo Remotely obtained description +echo +"${JUST_MR}" --norc --local-build-root "${LBR2}" \ + --remote-serve-address ${SERVE} \ + -r ${REMOTE_EXECUTION_ADDRESS} ${COMPAT} \ + --log-limit 6 \ + --just "${JUST}" describe > "${OUT}/describe" +cat "${OUT}/describe" +echo + +diff -u "${OUT}/describe.orig" "${OUT}/describe" + + +echo OK |