diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-02 13:16:55 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-02 14:09:02 +0200 |
commit | 25c9c5f2007468011cae28d031775a515ee94164 (patch) | |
tree | 9319cf7afb3afcfaf6ad2299188480ad9c664b99 | |
parent | b2f795e0e05743a234587f3a1c32c9c1d4ec524f (diff) | |
download | justbuild-25c9c5f2007468011cae28d031775a515ee94164.tar.gz |
End-to-end test: verify unrelated cwd
... also ensuring that the implict empty tree is added as input.
-rw-r--r-- | test/end-to-end/actions/cwd.sh | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/test/end-to-end/actions/cwd.sh b/test/end-to-end/actions/cwd.sh index 65344ce0..9a86d655 100644 --- a/test/end-to-end/actions/cwd.sh +++ b/test/end-to-end/actions/cwd.sh @@ -18,6 +18,7 @@ set -e readonly ROOT="$(pwd)" readonly LBR="${TMPDIR}/local-build-root" readonly OUT="${TMPDIR}/out" +mkdir -p "${OUT}" readonly JUST="${ROOT}/bin/tool-under-test" mkdir work @@ -82,18 +83,33 @@ cat > TARGETS <<'EOF' , "outs": ["work/hello.txt", "log/log.txt"] , "deps": ["inputs"] } +, "rule-unrelated-cwd": + { "type": "action" + , "cmd": + ["sh", "../tools/bin/generate.sh", "../work/name.txt", "../work/hello.txt"] + , "cwd": ["unrelated"] + , "outs": ["work/hello.txt", "log/log.txt"] + , "deps": ["inputs"] + } +, "generic-unrelated-cwd": + { "type": "generic" + , "cmds": ["sh ../tools/bin/generate.sh ../work/name.txt ../work/hello.txt"] + , "cwd": "unrelated" + , "outs": ["work/hello.txt", "log/log.txt"] + , "deps": ["inputs"] + } } EOF cat > generate.sh <<'EOF' -echo -n 'Hello ' > hello.txt -cat $1 >> hello.txt -echo '!' >> hello.txt +echo -n 'Hello ' > ${2:-hello.txt} +cat $1 >> ${2:-hello.txt} +echo '!' >> ${2:-hello.txt} mkdir -p ../log echo DoNe >> ../log/log.txt EOF echo -n WoRlD > name.txt -for target in rule generic +for target in rule generic rule-unrelated-cwd generic-unrelated-cwd do echo @@ -101,7 +117,11 @@ echo Action obtained for target $target echo "${JUST}" analyse \ --local-build-root "${LBR}" \ - --dump-actions - "$target" 2>&1 + --dump-actions "${OUT}/${target}-actions.json" \ + "$target" 2>&1 +echo +cat "${OUT}/${target}-actions.json" +echo echo echo Verify correct action execution for target $target @@ -116,4 +136,11 @@ grep DoNe "${OUT}/$target/log/log.txt" done +# Verify the input trees + +[ $(jq '.[0].input | keys | . == ["tools/bin/generate.sh", "work/name.txt"]' "${OUT}/rule-actions.json") = true ] +[ $(jq '.[0].input | keys | . == ["tools/bin/generate.sh", "work/name.txt"]' "${OUT}/generic-actions.json") = true ] +[ $(jq '.[0].input | keys | . == ["tools/bin/generate.sh", "unrelated", "work/name.txt"]' "${OUT}/rule-unrelated-cwd-actions.json") = true ] +[ $(jq '.[0].input | keys | . == ["tools/bin/generate.sh", "unrelated", "work/name.txt"]' "${OUT}/generic-unrelated-cwd-actions.json") = true ] + echo OK |