diff options
Diffstat (limited to 'shell/test')
-rw-r--r-- | shell/test/EXPRESSIONS | 90 | ||||
-rw-r--r-- | shell/test/RULES | 7 | ||||
-rwxr-xr-x | shell/test/runner | 2 |
3 files changed, 94 insertions, 5 deletions
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS index 80e6cdb..e158a4c 100644 --- a/shell/test/EXPRESSIONS +++ b/shell/test/EXPRESSIONS @@ -14,6 +14,11 @@ , "imports": { "artifacts_list": ["./", "../..", "field_artifacts_list"] , "runfiles_list": ["./", "../..", "field_runfiles_list"] + , "default-TOOLCHAIN": ["./", "../../CC", "default-TOOLCHAIN"] + , "default-NON_SYSTEM_TOOLS": + ["./", "../../CC", "default-NON_SYSTEM_TOOLS"] + , "default-PATH": ["./", "../../CC", "default-PATH"] + , "default-sh": ["./", "..", "default-sh"] } , "expression": { "type": "let*" @@ -42,6 +47,86 @@ } } ] + , ["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 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"} + } + ] + , [ "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": @@ -106,7 +191,9 @@ , "key": "work" , "value": {"type": "var", "name": "deps"} } + , {"type": "var", "name": "toolchain"} , {"type": "var", "name": "runner"} + , {"type": "var", "name": "invocation"} , {"type": "var", "name": "test.sh"} , {"type": "var", "name": "attempt marker"} ] @@ -115,9 +202,6 @@ , [ "cmd" , {"type": "++", "$1": [["./runner"], {"type": "var", "name": "keep"}]} ] - , [ "test_env" - , {"type": "var", "name": "TEST_ENV", "default": {"type": "empty_map"}} - ] ] , "body": { "type": "if" diff --git a/shell/test/RULES b/shell/test/RULES index 44acb00..6539622 100644 --- a/shell/test/RULES +++ b/shell/test/RULES @@ -49,6 +49,7 @@ [ "Tool to aggregate the results of individual test runs (for flakyness" , "detection) to an overall test result." ] + , "defaults": ["The shell toolcahin to use."] } , "config_doc": { "RUNS_PER_TEST": @@ -93,7 +94,11 @@ , "As the built-in \"install\" rule only takes the runfiles of its \"deps\"" , "argument, this gives an easy way of defining test suites." ] - , "implicit": {"runner": ["runner"], "summarizer": ["summarizer"]} + , "implicit": + { "runner": ["runner"] + , "summarizer": ["summarizer"] + , "defaults": [["./", "..", "defaults"]] + } , "imports": { "test-result": "test-result" , "action": "test-action" diff --git a/shell/test/runner b/shell/test/runner index a99d5b7..f762355 100755 --- a/shell/test/runner +++ b/shell/test/runner @@ -35,7 +35,7 @@ cd work date +%s > ../time-start # TODO: # - proper wrapping with timeout -if sh ../test.sh > ../stdout 2> ../stderr +if . ../invocation > ../stdout 2> ../stderr then RESULT=PASS else |