diff options
-rw-r--r-- | test/TARGETS | 3 | ||||
-rw-r--r-- | test/end-to-end/TARGETS | 8 | ||||
-rw-r--r-- | test/end-to-end/actions/TARGETS | 9 | ||||
-rwxr-xr-x | test/end-to-end/actions/action-equality.sh | 60 |
4 files changed, 79 insertions, 1 deletions
diff --git a/test/TARGETS b/test/TARGETS index ed206b74..27a269d4 100644 --- a/test/TARGETS +++ b/test/TARGETS @@ -11,6 +11,7 @@ , "dirs": [ [["./", "buildtool", "TESTS"], "buildtool"] , [["./", "utils", "TESTS"], "utils"] + , [["./", "end-to-end", "TESTS"], "end-to-end"] ] } , "ALL": @@ -21,4 +22,4 @@ , "arch": [{"type": "var", "name": "ARCH", "default": "x86_64"}] , "target": ["TESTS"] } -}
\ No newline at end of file +} diff --git a/test/end-to-end/TARGETS b/test/end-to-end/TARGETS new file mode 100644 index 00000000..b7e03a0d --- /dev/null +++ b/test/end-to-end/TARGETS @@ -0,0 +1,8 @@ +{ "tool-under-test": + {"type": "install", "files": {"bin/tool-under-test": [".", "just"]}} +, "TESTS": + { "type": "install" + , "tainted": ["test"] + , "dirs": [[["./", "actions", "TESTS"], "actions"]] + } +} diff --git a/test/end-to-end/actions/TARGETS b/test/end-to-end/actions/TARGETS new file mode 100644 index 00000000..a941906f --- /dev/null +++ b/test/end-to-end/actions/TARGETS @@ -0,0 +1,9 @@ +{ "equality": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["equality"] + , "test": ["action-equality.sh"] + , "keep": ["graph.json"] + , "deps": [["test/end-to-end", "tool-under-test"]] + } +, "TESTS": {"type": "install", "tainted": ["test"], "deps": ["equality"]} +} diff --git a/test/end-to-end/actions/action-equality.sh b/test/end-to-end/actions/action-equality.sh new file mode 100755 index 00000000..f0ce86b3 --- /dev/null +++ b/test/end-to-end/actions/action-equality.sh @@ -0,0 +1,60 @@ +#!/bin/sh +set -e + +mkdir .tool-root +touch ROOT +cat > TARGETS <<'EOI' +{ "foo": + { "type": "generic" + , "outs": ["out.txt"] + , "cmds": ["echo Hello World > out.txt"] + } +, "bar": + { "type": "generic" + , "outs": ["out.txt"] + , "cmds": ["echo Hello World > out.txt"] + } +, "baz": + { "type": "generic" + , "outs": ["out.txt"] + , "cmds": ["echo -n Hello > out.txt && echo ' World' >> out.txt"] + } +, "foo upper": + { "type": "generic" + , "deps": ["foo"] + , "outs": ["upper.txt"] + , "cmds": ["cat out.txt | tr a-z A-Z > upper.txt"] + } +, "bar upper": + { "type": "generic" + , "deps": ["bar"] + , "outs": ["upper.txt"] + , "cmds": ["cat out.txt | tr a-z A-Z > upper.txt"] + } +, "baz upper": + { "type": "generic" + , "deps": ["baz"] + , "outs": ["upper.txt"] + , "cmds": ["cat out.txt | tr a-z A-Z > upper.txt"] + } +, "ALL": + { "type": "install" + , "files": + {"foo.txt": "foo upper", "bar.txt": "bar upper", "baz.txt": "baz upper"} + } +} +EOI + + +bin/tool-under-test build -J 1 --local_build_root .tool-root 2>log +cat log +echo +grep '4 actions' log +grep '1 cache hit' log + +echo +bin/tool-under-test analyse --dump_graph graph.json +echo +matching_targets=$(cat graph.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .target]] | sort') +echo "${matching_targets}" +[ "${matching_targets}" = '[[["@","","","bar"],["@","","","foo"]],[["@","","","bar upper"],["@","","","foo upper"]],[["@","","","baz"]],[["@","","","baz upper"]]]' ] |