diff options
Diffstat (limited to 'tests/test_rules')
-rw-r--r-- | tests/test_rules/RULES | 33 | ||||
-rwxr-xr-x | tests/test_rules/test_runner.py | 3 |
2 files changed, 34 insertions, 2 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"] diff --git a/tests/test_rules/test_runner.py b/tests/test_rules/test_runner.py index 6fd2d8c..5c0d129 100755 --- a/tests/test_rules/test_runner.py +++ b/tests/test_rules/test_runner.py @@ -53,7 +53,8 @@ for t in config.get('targets', []): should_fail = t[0] == "-" ret = subprocess.run([ "./bin/just", "install", "--local-build-root", "./build_root", "-C", - "repos.json", "-o", "/".join(["./outs", target]), target + "repos.json", "-o", "/".join(["./outs", target]), + "-c", "conf_vars.json", target ], capture_output=True) success = ret.returncode != 0 if should_fail else ret.returncode == 0 |