diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/end-to-end/actions/TARGETS | 9 | ||||
-rwxr-xr-x | test/end-to-end/actions/action-equality-properties.sh | 58 |
2 files changed, 64 insertions, 3 deletions
diff --git a/test/end-to-end/actions/TARGETS b/test/end-to-end/actions/TARGETS index 08a617e6..43bb09a0 100644 --- a/test/end-to-end/actions/TARGETS +++ b/test/end-to-end/actions/TARGETS @@ -23,7 +23,14 @@ { "type": ["@", "rules", "shell/test", "script"] , "name": ["equality-properties"] , "test": ["action-equality-properties.sh"] - , "keep": ["graph-null.json", "graph-empty.json", "graph-set.json"] + , "keep": + [ "rules/graph-null.json" + , "rules/graph-empty.json" + , "rules/graph-set.json" + , "generic/graph-null.json" + , "generic/graph-empty.json" + , "generic/graph-set.json" + ] , "deps": [["end-to-end", "tool-under-test"]] } , "trees": diff --git a/test/end-to-end/actions/action-equality-properties.sh b/test/end-to-end/actions/action-equality-properties.sh index 101bb878..c2b900eb 100755 --- a/test/end-to-end/actions/action-equality-properties.sh +++ b/test/end-to-end/actions/action-equality-properties.sh @@ -15,9 +15,12 @@ set -e +readonly ROOT="$(pwd)" readonly LBRDIR="$TMPDIR/local-build-root" -readonly JUST="bin/tool-under-test" +readonly JUST="${ROOT}/bin/tool-under-test" +mkdir -p "${ROOT}/rules" +cd "${ROOT}/rules" touch ROOT cat > RULES <<'EOI' { "": @@ -27,7 +30,7 @@ cat > RULES <<'EOI' , "artifacts": { "type": "ACTION" , "outs": ["out.txt"] - , "cmd": ["sh", "-c", "echo Hello > out.txt"] + , "cmd": ["sh", "-c", "echo Hello > out.txt\n"] , "execution properties": {"type": "var", "name": "PROPERTIES"} } } @@ -57,6 +60,47 @@ cat > TARGETS <<'EOI' } EOI +mkdir -p "${ROOT}/generic" +cd "${ROOT}/generic" +touch ROOT + +cat > TARGETS <<'EOI' +{ "flexible": + { "type": "generic" + , "arguments_config": ["PROPERTIES"] + , "outs": ["out.txt"] + , "cmds": ["echo Hello > out.txt"] + , "execution properties": {"type": "var", "name": "PROPERTIES"} + } +, "fixed": + { "type": "configure" + , "target": "flexible" + , "config": + { "type": "singleton_map" + , "key": "PROPERTIES" + , "value": {"type": "empty_map"} + } + } +, "unset": + { "type": "configure" + , "target": "flexible" + , "config": {"type": "singleton_map", "key": "PROPERTIES", "value": null} + } +, "": + { "type": "install" + , "files": {"flexible": "flexible", "fixed": "fixed", "unset": "unset"} + } +} +EOI + + + +for variant in rules generic +do +echo "Testing variant ${variant}" +echo +cd "${ROOT}/${variant}" + "${JUST}" analyse --local-build-root "${LBRDIR}" --dump-graph graph-null.json 2>&1 action_configs=$(cat graph-null.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .config.PROPERTIES ]] | sort') echo "${action_configs}" @@ -73,4 +117,14 @@ action_configs=$(cat graph-set.json | jq -acM '.actions | [ .[] | .origins | [ . echo "${action_configs}" [ "${action_configs}" = '[[null,{}],[{"foo":"bar"}]]' ] +echo "variant ${variant} OK" +echo +done + +# also verify the consistency of the generated actions +for graph in graph-null.json graph-empty.json graph-set.json +do + diff -u "${ROOT}/rules/${graph}" "${ROOT}/generic/${graph}" +done + echo OK |