summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-06-07 12:37:22 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-06-07 12:37:22 +0200
commit816db9ca82bbcc5c953a5f6449d6768941749888 (patch)
tree3a0058d9273246f127de386dd3a108a54253d70c
parentb9d0a59e7832f87431efb377e760773a075a4bfd (diff)
downloadrules-cc-816db9ca82bbcc5c953a5f6449d6768941749888.tar.gz
rules: Support TEST_ENV for shell/test script
-rw-r--r--shell/test/EXPRESSIONS9
-rw-r--r--shell/test/RULES3
2 files changed, 9 insertions, 3 deletions
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS
index 2a99876..6d163f3 100644
--- a/shell/test/EXPRESSIONS
+++ b/shell/test/EXPRESSIONS
@@ -1,5 +1,5 @@
{ "test-action":
- { "vars": ["name", "test.sh", "ATTEMPT"]
+ { "vars": ["name", "test.sh", "ATTEMPT", "TEST_ENV"]
, "imports":
{ "artifacts_list": ["./", "../..", "field_artifacts_list"]
, "runfiles_list": ["./", "../..", "field_runfiles_list"]
@@ -103,6 +103,9 @@
, "$1": [["./runner"], {"type": "FIELD", "name": "keep"}]
}
]
+ , [ "test_env"
+ , {"type": "var", "name": "TEST_ENV", "default": {"type": "empty_map"}}
+ ]
]
, "body":
{ "type": "if"
@@ -113,6 +116,7 @@
, "outs": {"type": "var", "name": "outs"}
, "inputs": {"type": "var", "name": "inputs"}
, "cmd": {"type": "var", "name": "cmd"}
+ , "env": {"type": "var", "name": "test_env"}
, "may_fail": ["test"]
, "fail_message":
{ "type": "join"
@@ -124,6 +128,7 @@
, "outs": {"type": "var", "name": "outs"}
, "inputs": {"type": "var", "name": "inputs"}
, "cmd": {"type": "var", "name": "cmd"}
+ , "env": {"type": "var", "name": "test_env"}
, "may_fail": ["test"]
, "no_cache": ["test"]
, "fail_message":
@@ -141,7 +146,7 @@
}
}
, "test-result":
- { "vars": ["name", "test.sh"]
+ { "vars": ["name", "test.sh", "TEST_ENV"]
, "imports": {"action": "test-action"}
, "expression":
{ "type": "let*"
diff --git a/shell/test/RULES b/shell/test/RULES
index 74a0b78..c4beec4 100644
--- a/shell/test/RULES
+++ b/shell/test/RULES
@@ -2,7 +2,7 @@
{ "doc": ["Shell test, given by a test script"]
, "target_fields": ["deps", "test"]
, "string_fields": ["keep", "name"]
- , "config_vars": ["RUNS_PER_TEST"]
+ , "config_vars": ["RUNS_PER_TEST", "TEST_ENV"]
, "field_doc":
{ "test": ["The shell script for the test, launched with sh"]
, "name":
@@ -24,6 +24,7 @@
[ "The number of times the test should be run in order to detect flakyness."
, "If set, no test action will be taken from cache."
]
+ , "TEST_ENV": ["The environment for executing the test runner."]
}
, "tainted": ["test"]
, "artifacts_doc":