summaryrefslogtreecommitdiff
path: root/shell/test
diff options
context:
space:
mode:
Diffstat (limited to 'shell/test')
-rw-r--r--shell/test/EXPRESSIONS87
-rw-r--r--shell/test/RULES7
-rwxr-xr-xshell/test/runner2
3 files changed, 94 insertions, 2 deletions
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS
index 2692c31..2526973 100644
--- a/shell/test/EXPRESSIONS
+++ b/shell/test/EXPRESSIONS
@@ -15,6 +15,11 @@
{ "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"]
}
, "expression":
{ "type": "let*"
@@ -43,6 +48,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":
@@ -124,7 +209,9 @@
, "key": "libs"
, "value": {"type": "var", "name": "run-libs"}
}
+ , {"type": "var", "name": "toolchain"}
, {"type": "var", "name": "runner"}
+ , {"type": "var", "name": "invocation"}
, {"type": "var", "name": "test.sh"}
, {"type": "var", "name": "attempt marker"}
]
diff --git a/shell/test/RULES b/shell/test/RULES
index ec26609..7a7aebd 100644
--- a/shell/test/RULES
+++ b/shell/test/RULES
@@ -53,6 +53,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":
@@ -97,7 +98,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 97c75ef..2f97005 100755
--- a/shell/test/runner
+++ b/shell/test/runner
@@ -36,7 +36,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