diff options
Diffstat (limited to 'rules/shell/test/EXPRESSIONS')
-rw-r--r-- | rules/shell/test/EXPRESSIONS | 378 |
1 files changed, 378 insertions, 0 deletions
diff --git a/rules/shell/test/EXPRESSIONS b/rules/shell/test/EXPRESSIONS new file mode 100644 index 0000000..b58bb49 --- /dev/null +++ b/rules/shell/test/EXPRESSIONS @@ -0,0 +1,378 @@ +{ "test-action": + { "vars": + [ "TEST_ENV" + , "TIMEOUT_SCALE" + , "ATTEMPT" + , "name" + , "test.sh" + , "keep" + , "keep-dirs" + , "runner" + , "deps-fieldname" + , "deps-transition" + , "target properties" + ] + , "imports": + { "artifacts_list": ["./", "../..", "field_artifacts_list"] + , "runfiles_list": ["./", "../..", "field_runfiles_list"] + , "map_provider": ["./", "../..", "field_map_provider"] + , "default-TOOLCHAIN": ["./", "../../CC", "default-TOOLCHAIN"] + , "default-NON_SYSTEM_TOOLS": + ["./", "../../CC", "default-NON_SYSTEM_TOOLS"] + , "default-PATH": ["./", "../../CC", "default-PATH"] + , "default-sh": ["./", "..", "default-sh"] + , "sh prolog": ["shell", "prolog"] + } + , "expression": + { "type": "let*" + , "bindings": + [ [ "runner" + , { "type": "map_union" + , "$1": + { "type": "foreach" + , "var": "runner" + , "range": {"type": "var", "name": "runner"} + , "body": + { "type": "map_union" + , "$1": + { "type": "foreach" + , "var": "runner" + , "range": + { "type": "values" + , "$1": + { "type": "DEP_ARTIFACTS" + , "dep": {"type": "var", "name": "runner"} + } + } + , "body": {"type": "env", "vars": ["runner"]} + } + } + } + } + ] + , ["toolchain dirname", "toolchain"] + , [ "toolchain" + , { "type": "to_subdir" + , "subdir": {"type": "var", "name": "toolchain dirname"} + , "$1": {"type": "CALL_EXPRESSION", "name": "default-TOOLCHAIN"} + } + ] + , ["sh", {"type": "CALL_EXPRESSION", "name": "default-sh"}] + , [ "NON_SYSTEM_TOOLS" + , {"type": "CALL_EXPRESSION", "name": "default-NON_SYSTEM_TOOLS"} + ] + , [ "sh from outside" + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "sh" + , "map": {"type": "var", "name": "NON_SYSTEM_TOOLS"} + } + , "then": + { "type": "join" + , "$1": ["./toolchain/", {"type": "var", "name": "sh"}] + } + , "else": {"type": "var", "name": "sh"} + } + ] + , [ "sh from workdir" + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "sh" + , "map": {"type": "var", "name": "NON_SYSTEM_TOOLS"} + } + , "then": + { "type": "join" + , "$1": ["../toolchain/", {"type": "var", "name": "sh"}] + } + , "else": {"type": "var", "name": "sh"} + } + ] + , [ "with-env" + , { "type": "singleton_map" + , "key": "with-env" + , "value": + { "type": "BLOB" + , "data": + { "type": "join" + , "separator": "\n" + , "$1": + { "type": "++" + , "$1": + [ { "type": "let*" + , "bindings": [["fieldname", "defaults"]] + , "body": {"type": "CALL_EXPRESSION", "name": "sh prolog"} + } + , [ "" + , { "type": "join_cmd" + , "$1": + { "type": "++" + , "$1": [["./runner"], {"type": "var", "name": "keep"}] + } + } + , "" + ] + ] + } + } + } + } + ] + , [ "invocation cmd" + , [{"type": "var", "name": "sh from workdir"}, "../test.sh"] + ] + , [ "invocation" + , { "type": "singleton_map" + , "key": "invocation" + , "value": + { "type": "BLOB" + , "data": + { "type": "join_cmd" + , "$1": {"type": "var", "name": "invocation cmd"} + } + } + } + ] + , [ "test_env" + , {"type": "var", "name": "TEST_ENV", "default": {"type": "empty_map"}} + ] + , [ "test_env PATH" + , { "type": "lookup" + , "key": "PATH" + , "map": {"type": "var", "name": "test_env"} + } + ] + , [ "PATH" + , { "type": "join" + , "separator": ":" + , "$1": + { "type": "++" + , "$1": + [ { "type": "if" + , "cond": {"type": "var", "name": "test_env PATH"} + , "then": [{"type": "var", "name": "test_env PATH"}] + } + , {"type": "CALL_EXPRESSION", "name": "default-PATH"} + ] + } + } + ] + , [ "test_env" + , { "type": "if" + , "cond": {"type": "var", "name": "PATH"} + , "then": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "test_env"} + , { "type": "singleton_map" + , "key": "PATH" + , "value": {"type": "var", "name": "PATH"} + } + ] + } + , "else": {"type": "var", "name": "test_env"} + } + ] + , [ "deps" + , { "type": "TREE" + , "$1": + { "type": "disjoint_map_union" + , "msg": + [ "Field" + , {"type": "var", "name": "deps-fieldname"} + , "has to stage in a conflict free way" + ] + , "$1": + { "type": "++" + , "$1": + { "type": "let*" + , "bindings": + [ ["fieldname", {"type": "var", "name": "deps-fieldname"}] + , ["transition", {"type": "var", "name": "deps-transition"}] + ] + , "body": + [ {"type": "CALL_EXPRESSION", "name": "runfiles_list"} + , {"type": "CALL_EXPRESSION", "name": "artifacts_list"} + ] + } + } + } + } + ] + , [ "run-libs" + , { "type": "TREE" + , "$1": + { "type": "let*" + , "bindings": + [ ["fieldname", {"type": "var", "name": "deps-fieldname"}] + , ["provider", "run-libs"] + , ["transition", {"type": "var", "name": "deps-transition"}] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "map_provider"} + } + } + ] + , [ "attempt marker" + , { "type": "if" + , "cond": + { "type": "==" + , "$1": {"type": "var", "name": "ATTEMPT"} + , "$2": null + } + , "then": {"type": "empty_map"} + , "else": + { "type": "singleton_map" + , "key": "ATTEMPT" + , "value": + {"type": "BLOB", "data": {"type": "var", "name": "ATTEMPT"}} + } + } + ] + , [ "outs" + , { "type": "++" + , "$1": + [ ["result", "stdout", "stderr", "time-start", "time-stop", "pwd"] + , { "type": "foreach" + , "var": "filename" + , "range": {"type": "var", "name": "keep"} + , "body": + { "type": "join" + , "$1": ["work/", {"type": "var", "name": "filename"}] + } + } + ] + } + ] + , [ "out_dirs" + , { "type": "foreach" + , "var": "dir_path" + , "range": {"type": "var", "name": "keep-dirs"} + , "body": + { "type": "join" + , "$1": ["work/", {"type": "var", "name": "dir_path"}] + } + } + ] + , [ "inputs" + , { "type": "map_union" + , "$1": + [ { "type": "singleton_map" + , "key": "work" + , "value": {"type": "var", "name": "deps"} + } + , { "type": "singleton_map" + , "key": "libs" + , "value": {"type": "var", "name": "run-libs"} + } + , {"type": "var", "name": "toolchain"} + , {"type": "var", "name": "with-env"} + , {"type": "var", "name": "runner"} + , {"type": "var", "name": "invocation"} + , {"type": "var", "name": "test.sh"} + , {"type": "var", "name": "attempt marker"} + ] + } + ] + , ["cmd", [{"type": "var", "name": "sh from outside"}, "with-env"]] + , [ "test_env" + , { "type": "map_union" + , "$1": + [ { "type": "if" + , "cond": + { "type": "==" + , "$1": {"type": "var", "name": "ATTEMPT"} + , "$2": null + } + , "then": {"type": "empty_map"} + , "else": + { "type": "singleton_map" + , "key": "TEST_RUN_NUMBER" + , "value": {"type": "var", "name": "ATTEMPT"} + } + } + , {"type": "var", "name": "test_env"} + ] + } + ] + ] + , "body": + { "type": "if" + , "cond": + {"type": "==", "$1": {"type": "var", "name": "ATTEMPT"}, "$2": null} + , "then": + { "type": "ACTION" + , "outs": {"type": "var", "name": "outs"} + , "out_dirs": {"type": "var", "name": "out_dirs"} + , "inputs": {"type": "var", "name": "inputs"} + , "cmd": {"type": "var", "name": "cmd"} + , "env": {"type": "var", "name": "test_env"} + , "may_fail": ["test"] + , "fail_message": + { "type": "join" + , "$1": ["shell test ", {"type": "var", "name": "name"}, " failed"] + } + , "timeout scaling": + {"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0} + , "execution properties": {"type": "var", "name": "target properties"} + } + , "else": + { "type": "ACTION" + , "outs": {"type": "var", "name": "outs"} + , "out_dirs": {"type": "var", "name": "out_dirs"} + , "inputs": {"type": "var", "name": "inputs"} + , "cmd": {"type": "var", "name": "cmd"} + , "env": {"type": "var", "name": "test_env"} + , "may_fail": ["test"] + , "no_cache": ["test"] + , "fail_message": + { "type": "join" + , "$1": + [ "shell test " + , {"type": "var", "name": "name"} + , " failed (Run " + , {"type": "var", "name": "ATTEMPT"} + , ")" + ] + } + , "timeout scaling": + {"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0} + , "execution properties": {"type": "var", "name": "target properties"} + } + } + } + } +, "test-result": + { "vars": + [ "TEST_ENV" + , "TIMEOUT_SCALE" + , "name" + , "test.sh" + , "keep" + , "keep-dirs" + , "runner" + , "deps-fieldname" + , "deps-transition" + , "target properties" + ] + , "imports": {"action": "test-action"} + , "expression": + { "type": "let*" + , "bindings": + [ ["test-results", {"type": "CALL_EXPRESSION", "name": "action"}] + , [ "runfiles" + , { "type": "singleton_map" + , "key": {"type": "var", "name": "name"} + , "value": + {"type": "TREE", "$1": {"type": "var", "name": "test-results"}} + } + ] + ] + , "body": + { "type": "RESULT" + , "artifacts": {"type": "var", "name": "test-results"} + , "runfiles": {"type": "var", "name": "runfiles"} + } + } + } +} |