summaryrefslogtreecommitdiff
path: root/CC/test/RULES
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-12-07 14:50:53 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2022-12-09 13:13:21 +0100
commit164bc8a638e50a69466dae5f1b0e0355daa5f20c (patch)
treed7a25fc6c13c28b547a2879921cf319b731484db /CC/test/RULES
parentd0fd0957b485cb28e22557f3fab11075cd5a6b8b (diff)
downloadrules-cc-164bc8a638e50a69466dae5f1b0e0355daa5f20c.tar.gz
rules: Add argument support for test binaries
Diffstat (limited to 'CC/test/RULES')
-rw-r--r--CC/test/RULES41
1 files changed, 32 insertions, 9 deletions
diff --git a/CC/test/RULES b/CC/test/RULES
index b42b6c4..44cf1c4 100644
--- a/CC/test/RULES
+++ b/CC/test/RULES
@@ -7,6 +7,7 @@
, "target_fields": ["srcs", "private-hdrs", "private-deps", "data"]
, "string_fields":
[ "name"
+ , "args"
, "stage"
, "pure C"
, "private-defines"
@@ -25,13 +26,14 @@
, "CC_TEST_LAUNCHER"
]
, "implicit":
- {"defaults": [["./", "..", "defaults"]], "runner": ["test_runner.sh"]}
+ {"defaults": [["./", "..", "defaults"]], "runner": ["test_runner.py"]}
, "field_doc":
{ "name":
[ "The name of the test"
, ""
, "Used to name the test binary as well as for staging the test result"
]
+ , "args": ["Command line arguments for the test binary"]
, "srcs": ["The sources of the test binary"]
, "private-hdrs":
[ "Any additional header files that need to be present when compiling"
@@ -198,7 +200,7 @@
}
, "body":
{ "type": "singleton_map"
- , "key": "runner.sh"
+ , "key": "runner"
, "value": {"type": "var", "name": "runner"}
}
}
@@ -206,6 +208,31 @@
}
}
]
+ , [ "test-args"
+ , { "type": "singleton_map"
+ , "key": "test-args.json"
+ , "value":
+ { "type": "BLOB"
+ , "data":
+ { "type": "json_encode"
+ , "$1": {"type": "FIELD", "name": "args", "default": []}
+ }
+ }
+ }
+ ]
+ , [ "test-launcher"
+ , { "type": "singleton_map"
+ , "key": "test-launcher.json"
+ , "value":
+ { "type": "BLOB"
+ , "data":
+ { "type": "json_encode"
+ , "$1":
+ {"type": "var", "name": "CC_TEST_LAUNCHER", "default": []}
+ }
+ }
+ }
+ ]
, [ "data"
, { "type": "disjoint_map_union"
, "msg": "Data runfiles may not conflict"
@@ -234,16 +261,12 @@
, "$1": {"type": "var", "name": "data"}
}
, {"type": "var", "name": "runner"}
+ , {"type": "var", "name": "test-args"}
+ , {"type": "var", "name": "test-launcher"}
, {"type": "var", "name": "staged test binary"}
]
}
- , "cmd":
- { "type": "++"
- , "$1":
- [ ["sh", "./runner.sh"]
- , {"type": "var", "name": "CC_TEST_LAUNCHER", "default": []}
- ]
- }
+ , "cmd": ["./runner"]
, "env":
{ "type": "var"
, "name": "TEST_ENV"