diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-08-28 11:25:12 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-08-28 16:59:45 +0200 |
commit | 86300a0cd1f7197f9a4a61257c4616d49e573d87 (patch) | |
tree | d957443d021184f02e96686cd230755951dec284 /test/end-to-end/built-in-rules | |
parent | 909814a8730e5cf24c4e0984e946ec0066515257 (diff) | |
download | justbuild-86300a0cd1f7197f9a4a61257c4616d49e573d87.tar.gz |
Add end-to-end test that the shell is settable in "generic"
Diffstat (limited to 'test/end-to-end/built-in-rules')
-rw-r--r-- | test/end-to-end/built-in-rules/TARGETS | 15 | ||||
-rw-r--r-- | test/end-to-end/built-in-rules/generic_sh.sh | 47 |
2 files changed, 61 insertions, 1 deletions
diff --git a/test/end-to-end/built-in-rules/TARGETS b/test/end-to-end/built-in-rules/TARGETS index f37849ae..e668dd84 100644 --- a/test/end-to-end/built-in-rules/TARGETS +++ b/test/end-to-end/built-in-rules/TARGETS @@ -4,6 +4,13 @@ , "test": ["generic_out_dirs.sh"] , "deps": [["end-to-end", "tool-under-test"]] } +, "generic_sh": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["generic_sh"] + , "test": ["generic_sh.sh"] + , "keep": ["null.json", "empty.json", "custom.json"] + , "deps": [["end-to-end", "tool-under-test"]] + } , "filegen_config": { "type": ["@", "rules", "shell/test", "script"] , "name": ["filegen_config"] @@ -25,6 +32,12 @@ , "TESTS": { "type": "install" , "tainted": ["test"] - , "deps": ["generic_out_dirs", "filegen_config", "tree", "symlink_config"] + , "deps": + [ "generic_out_dirs" + , "generic_sh" + , "filegen_config" + , "tree" + , "symlink_config" + ] } } diff --git a/test/end-to-end/built-in-rules/generic_sh.sh b/test/end-to-end/built-in-rules/generic_sh.sh new file mode 100644 index 00000000..294baf20 --- /dev/null +++ b/test/end-to-end/built-in-rules/generic_sh.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Copyright 2023 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 -e + +readonly ROOT="$(pwd)" +readonly LBRDIR="${TMPDIR}/local-build-root" +readonly JUST="${ROOT}/bin/tool-under-test" + +touch ROOT +cat > TARGETS <<'EOF' +{ "": + { "type": "generic" + , "arguments_config": ["SHC"] + , "cmds": ["first", "second"] + , "sh -c": {"type": "var", "name": "SHC"} + , "outs": ["some file"] + } +} +EOF + +"${JUST}" analyse --local-build-root "${LBRDIR}" \ + --dump-graph null.json 2>&1 +[ $(jq -aM '.actions | .[] | .command == ["sh", "-c", "first\nsecond\n"]' null.json) = true ] + +"${JUST}" analyse --local-build-root "${LBRDIR}" \ + -D '{"SHC": []}' --dump-graph empty.json 2>&1 +[ $(jq -aM '.actions | .[] | .command == ["sh", "-c", "first\nsecond\n"]' empty.json) = true ] + +"${JUST}" analyse --local-build-root "${LBRDIR}" \ + -D '{"SHC": ["custom-shell", "--fancy-option"]}' --dump-graph custom.json 2>&1 +[ $(jq -aM '.actions | .[] | .command == ["custom-shell", "--fancy-option", "first\nsecond\n"]' custom.json) = true ] + + +echo OK |