diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2024-06-04 11:49:04 +0200 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2024-06-04 14:53:39 +0200 |
commit | 53ca9245145536c62e1cff0b032ddf41f2a95a84 (patch) | |
tree | 46f02daf4aaffb0aedf7304e141cdd0f4819ab09 /tests/test_rules/RULES | |
parent | 4602b1967533b61a1fc2ea1bef5c16dcc30e84ba (diff) | |
download | rules-cc-53ca9245145536c62e1cff0b032ddf41f2a95a84.tar.gz |
["test_rules", "test_case"]: add config vars to be propagated to the runner
The config vars ENV, ARCH, HOST_ARCH, TARGET_ARCH, BUILD_ARCH, OS have been added.
This allows to test the rules with different configurations and/or set
required values via the "defaults" target of the rules under testing.
Diffstat (limited to 'tests/test_rules/RULES')
-rw-r--r-- | tests/test_rules/RULES | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/test_rules/RULES b/tests/test_rules/RULES index f53efba..69fe99d 100644 --- a/tests/test_rules/RULES +++ b/tests/test_rules/RULES @@ -1,5 +1,11 @@ { "test_case": - { "doc": ["Define a test case for rule tests."] + { "doc": + [ "Define a test case for rule tests." + , "The config variables \"ENV\", \"ARCH\", \"HOST_ARCH\", \"TARGET_ARCH\"," + , "\"BUILD_ARCH\", \"OS\" are collected in a file named \"conf_vars.json\"." + , "The test runner will pass that file as argument to \"-c\" to the \"just\"" + , "binary, which is internally called." + ] , "string_fields": ["name", "libs", "targets", "asserts"] , "target_fields": ["data"] , "field_doc": @@ -24,6 +30,8 @@ ["The directory that contains the project with the targets to test."] } , "tainted": ["test"] + , "config_vars": + ["ENV", "ARCH", "HOST_ARCH", "TARGET_ARCH", "BUILD_ARCH", "OS"] , "implicit": { "runner": ["test_runner.py"] , "rules": [["@", "test-rules", "", "tree"]] @@ -165,6 +173,28 @@ } } ] + , [ "conf_vars" + , { "type": "singleton_map" + , "key": "conf_vars.json" + , "value": + { "type": "BLOB" + , "data": + { "type": "json_encode" + , "$1": + { "type": "env" + , "vars": + [ "ENV" + , "ARCH" + , "HOST_ARCH" + , "TARGET_ARCH" + , "BUILD_ARCH" + , "OS" + ] + } + } + } + } + ] , [ "results" , { "type": "ACTION" , "inputs": @@ -178,6 +208,7 @@ , {"type": "var", "name": "repos"} , {"type": "var", "name": "work"} , {"type": "var", "name": "config"} + , {"type": "var", "name": "conf_vars"} ] } , "outs": ["stdout", "stderr", "result", "time-start", "time-stop"] |