summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-03-01 12:31:55 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2022-03-01 12:41:08 +0100
commite454095520c7b37a56db245b658a121f07b06ce3 (patch)
tree314cfa8570330d332c47f77ac57de82c8e41411a
parent10600edede9d4faf7ee2384ae25d5fb5c9af09b0 (diff)
downloadrules-cc-e454095520c7b37a56db245b658a121f07b06ce3.tar.gz
CC test: Add optional test launcher `CC_TEST_LAUNCHER`
-rw-r--r--CC/test/RULES15
-rw-r--r--CC/test/test_runner.sh2
2 files changed, 14 insertions, 3 deletions
diff --git a/CC/test/RULES b/CC/test/RULES
index de5a485..fa6fdbc 100644
--- a/CC/test/RULES
+++ b/CC/test/RULES
@@ -6,7 +6,8 @@
, "tainted": ["test"]
, "target_fields": ["srcs", "private-hdrs", "deps", "data"]
, "string_fields": ["name", "stage"]
- , "config_vars": ["CXX", "CC", "CXXFLAGS", "CFLAGS", "ENV"]
+ , "config_vars":
+ ["CXX", "CC", "CXXFLAGS", "CFLAGS", "ENV", "CC_TEST_LAUNCHER"]
, "implicit":
{ "defaults": [["./", "..", "defaults"]]
, "proto-deps": []
@@ -36,6 +37,10 @@
[ "The flags for CXX to be used instead of the default ones"
, "taken from the [\"CC\", \"defaults\"] target"
]
+ , "CC_TEST_LAUNCHER":
+ [ "List of strings representing the launcher that is prepend to the"
+ , "command line for running the test binary."
+ ]
}
, "imports":
{ "artifacts": ["./", "../..", "field_artifacts"]
@@ -238,7 +243,13 @@
, {"type": "var", "name": "staged test binary"}
]
}
- , "cmd": ["sh", "./runner.sh"]
+ , "cmd":
+ { "type": "++"
+ , "$1":
+ [ ["sh", "./runner.sh"]
+ , {"type": "var", "name": "CC_TEST_LAUNCHER", "default": []}
+ ]
+ }
, "may_fail": ["test"]
, "fail_message":
{ "type": "join"
diff --git a/CC/test/test_runner.sh b/CC/test/test_runner.sh
index ed9f48a..5256867 100644
--- a/CC/test/test_runner.sh
+++ b/CC/test/test_runner.sh
@@ -21,7 +21,7 @@ date +%s > ../time-start
# TODO:
# - proper wrapping with timeout
# - test arguments to select specific test cases
-if ../test > ../stdout 2> ../stderr
+if "$@" ../test > ../stdout 2> ../stderr
then
RESULT=PASS
else