diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-12 11:54:12 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-12 11:54:12 +0200 |
commit | fac7e7680e00dfc63eec41a33dff86d31571eb4b (patch) | |
tree | d341e6569290a21554ea9e5251c756b2b68096e8 /rules/CC | |
parent | 8d715c335756e406aea8a7e3e9e2266f69fbdeb9 (diff) | |
parent | 6fc2c2f66740c533d80990659cfce29b7db07eda (diff) | |
download | rules-cc-fac7e7680e00dfc63eec41a33dff86d31571eb4b.tar.gz |
Merge subtree 'rules' into rules-cc
Diffstat (limited to 'rules/CC')
-rw-r--r-- | rules/CC/test/EXPRESSIONS | 141 | ||||
-rw-r--r-- | rules/CC/test/RULES | 17 | ||||
-rwxr-xr-x | rules/CC/test/runner | 2 |
3 files changed, 111 insertions, 49 deletions
diff --git a/rules/CC/test/EXPRESSIONS b/rules/CC/test/EXPRESSIONS index fe4918e..27d92f3 100644 --- a/rules/CC/test/EXPRESSIONS +++ b/rules/CC/test/EXPRESSIONS @@ -38,6 +38,7 @@ , "test-args" , "test-data" , "summarizer" + , "summary artifacts" ] , "imports": { "artifacts": ["./", "../..", "field_artifacts"] @@ -173,7 +174,13 @@ [ [ "test-results" , { "type": "ACTION" , "outs": - ["result", "stdout", "stderr", "time-start", "time-stop"] + [ "result" + , "stdout" + , "stderr" + , "time-start" + , "time-stop" + , "pwd" + ] , "inputs": {"type": "var", "name": "test input"} , "cmd": ["./runner"] , "env": @@ -210,7 +217,7 @@ , "then": { "type": "let*" , "bindings": - [ [ "attempts" + [ [ "attempts (plain)" , { "type": "map_union" , "$1": { "type": "foreach" @@ -223,54 +230,74 @@ { "type": "singleton_map" , "key": {"type": "var", "name": "ATTEMPT"} , "value": + { "type": "ACTION" + , "outs": + ["result", "stdout", "stderr", "time-start", "time-stop"] + , "inputs": + { "type": "map_union" + , "$1": + [ { "type": "singleton_map" + , "key": "ATTEMPT" + , "value": + { "type": "BLOB" + , "data": {"type": "var", "name": "ATTEMPT"} + } + } + , {"type": "var", "name": "test input"} + ] + } + , "cmd": ["./runner"] + , "env": + { "type": "var" + , "name": "TEST_ENV" + , "default": {"type": "empty_map"} + } + , "may_fail": ["test"] + , "no_cache": ["test"] + , "fail_message": + { "type": "join" + , "$1": + [ "CC test " + , {"type": "var", "name": "test-name"} + , " failed (Run" + , {"type": "var", "name": "ATTEMPT"} + , ")" + ] + } + , "timeout scaling": + {"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0} + , "execution properties": + {"type": "var", "name": "target properties"} + } + } + } + } + ] + , [ "attempts (for summary)" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "range": {"type": "var", "name": "attempts (plain)"} + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": { "type": "TREE" , "$1": - { "type": "ACTION" - , "outs": - [ "result" - , "stdout" - , "stderr" - , "time-start" - , "time-stop" - ] - , "inputs": - { "type": "map_union" - , "$1": - [ { "type": "singleton_map" - , "key": "ATTEMPT" - , "value": - { "type": "BLOB" - , "data": {"type": "var", "name": "ATTEMPT"} - } + { "type": "map_union" + , "$1": + { "type": "foreach" + , "range": {"type": "var", "name": "summary artifacts"} + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": + { "type": "lookup" + , "map": {"type": "var", "name": "$_"} + , "key": {"type": "var", "name": "_"} } - , {"type": "var", "name": "test input"} - ] - } - , "cmd": ["./runner"] - , "env": - { "type": "var" - , "name": "TEST_ENV" - , "default": {"type": "empty_map"} - } - , "may_fail": ["test"] - , "no_cache": ["test"] - , "fail_message": - { "type": "join" - , "$1": - [ "CC test " - , {"type": "var", "name": "test-name"} - , " failed (Run" - , {"type": "var", "name": "ATTEMPT"} - , ")" - ] + } } - , "timeout scaling": - { "type": "var" - , "name": "TIMEOUT_SCALE" - , "default": 1.0 - } - , "execution properties": - {"type": "var", "name": "target properties"} } } } @@ -293,7 +320,7 @@ , "inputs": { "type": "map_union" , "$1": - [ {"type": "var", "name": "attempts"} + [ {"type": "var", "name": "attempts (for summary)"} , {"type": "var", "name": "summarizer"} ] } @@ -317,10 +344,28 @@ } } ] + , [ "attempts" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "range": {"type": "var", "name": "attempts (plain)"} + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": + {"type": "TREE", "$1": {"type": "var", "name": "$_"}} + } + } + } + ] , [ "artifacts" , { "type": "map_union" , "$1": - [ {"type": "var", "name": "summary"} + [ { "type": "singleton_map" + , "key": "pwd" + , "value": {"type": "BLOB", "data": "/summary"} + } + , {"type": "var", "name": "summary"} , { "type": "singleton_map" , "key": "work" , "value": diff --git a/rules/CC/test/RULES b/rules/CC/test/RULES index 9f3313d..244bca0 100644 --- a/rules/CC/test/RULES +++ b/rules/CC/test/RULES @@ -87,7 +87,8 @@ ] , "summarizer": [ "Tool to aggregate the results of individual test runs (for flakyness" - , "detection) to an overall test result." + , "detection) to an overall test result. If more fields than the result" + , "itself is needed, those can be specified using the \"summarizer\" rule." ] } , "config_doc": @@ -158,6 +159,7 @@ , " the respective file descriptor" , "time-start/time-stop: The time (decimally coded) in seconds since the" , " epoch when the test invocation started and ended." + , "pwd: the directory in which the test was carried out" ] , "runfiles_doc": [ "A tree consisting of the artifacts staged at the name of the test." @@ -171,6 +173,7 @@ , "host transition": ["transitions", "maybe for host"] , "stage": ["./", "../..", "stage_singleton_field"] , "run_test": "run_test" + , "field_list": ["", "field_list_provider"] } , "config_transitions": { "defaults": [{"type": "CALL_EXPRESSION", "name": "host transition"}] @@ -251,6 +254,18 @@ , "body": {"type": "CALL_EXPRESSION", "name": "stage"} } ] + , [ "summary artifacts" + , { "type": "++" + , "$1": + [ ["result"] + , { "type": "let*" + , "bindings": + [["provider", "artifacts"], ["fieldname", "summarizer"]] + , "body": {"type": "CALL_EXPRESSION", "name": "field_list"} + } + ] + } + ] ] , "body": {"type": "CALL_EXPRESSION", "name": "run_test"} } diff --git a/rules/CC/test/runner b/rules/CC/test/runner index 45a1bee..4984b17 100755 --- a/rules/CC/test/runner +++ b/rules/CC/test/runner @@ -36,6 +36,8 @@ def dump_results() -> None: f.write("%s\n" % (stdout, )) with open("stderr", "w") as f: f.write("%s\n" % (stderr, )) + with open("pwd", "w") as f: + f.write("%s\n" % (os.getcwd(), )) dump_results() |