diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-11 12:13:25 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-12 09:58:33 +0200 |
commit | 70cfd4babc0e03f9da6cff5e02ee4b0a1cf0d7a5 (patch) | |
tree | 699892c9b5ec4f40027a78aed76d951f3945869f /shell/test | |
parent | befb472b1b9650d485f46ae54227caea8bf81cdd (diff) | |
download | rules-cc-70cfd4babc0e03f9da6cff5e02ee4b0a1cf0d7a5.tar.gz |
Test rules: only provide to the summary action what is needed
... and add a rule allowing the summarizer to specify what it needs.
Diffstat (limited to 'shell/test')
-rw-r--r-- | shell/test/RULES | 110 | ||||
-rw-r--r-- | shell/test/TARGETS | 7 |
2 files changed, 92 insertions, 25 deletions
diff --git a/shell/test/RULES b/shell/test/RULES index ef67708..e3ee4a2 100644 --- a/shell/test/RULES +++ b/shell/test/RULES @@ -1,4 +1,31 @@ -{ "script": +{ "summarizer": + { "doc": + ["Specify a test summarizer together with the required additional fields"] + , "target_fields": ["summarizer"] + , "string_fields": ["artifacts"] + , "imports": {"stage": ["./", "../..", "stage_singleton_field"]} + , "field_doc": + { "summarizer": ["The single artifact acting as summarizer"] + , "artifacts": + [ "Any additional artifacts, besides \"result\", the summaries needs from" + , "the individual test results" + ] + } + , "expression": + { "type": "RESULT" + , "artifacts": + { "type": "let*" + , "bindings": [["fieldname", "summarizer"], ["location", "summarizer"]] + , "body": {"type": "CALL_EXPRESSION", "name": "stage"} + } + , "provides": + { "type": "singleton_map" + , "key": "artifacts" + , "value": {"type": "FIELD", "name": "artifacts"} + } + } + } +, "script": { "doc": ["Shell test, given by a test script"] , "target_fields": ["deps", "test"] , "string_fields": ["keep", "name"] @@ -48,7 +75,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." ] , "defaults": ["The shell toolcahin to use."] } @@ -111,6 +139,7 @@ , "stage": ["./", "../..", "stage_singleton_field"] , "host transition": ["transitions", "maybe for host"] , "target properties": ["transitions", "target properties"] + , "field_list": ["", "field_list_provider"] } , "config_transitions": { "deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}] @@ -158,7 +187,7 @@ , "then": { "type": "let*" , "bindings": - [ [ "attempts" + [ [ "attempts (plain)" , { "type": "map_union" , "$1": { "type": "foreach" @@ -170,37 +199,56 @@ , "body": { "type": "singleton_map" , "key": {"type": "var", "name": "ATTEMPT"} - , "value": - { "type": "TREE" - , "$1": {"type": "CALL_EXPRESSION", "name": "action"} - } + , "value": {"type": "CALL_EXPRESSION", "name": "action"} } } } ] , [ "summarizer" + , { "type": "let*" + , "bindings": + [["fieldname", "summarizer"], ["location", "summarizer"]] + , "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"} + } + ] + } + ] + , [ "attempts (for summary)" , { "type": "map_union" , "$1": - { "type": "foreach" - , "var": "x" - , "range": {"type": "FIELD", "name": "summarizer"} + { "type": "foreach_map" + , "range": {"type": "var", "name": "attempts (plain)"} , "body": - { "type": "map_union" - , "$1": - { "type": "foreach" - , "var": "x" - , "range": - { "type": "values" + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": + { "type": "TREE" + , "$1": + { "type": "map_union" , "$1": - { "type": "DEP_ARTIFACTS" - , "dep": {"type": "var", "name": "x"} + { "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": "_"} + } + } } } - , "body": - { "type": "singleton_map" - , "key": "summarizer" - , "value": {"type": "var", "name": "x"} - } } } } @@ -211,7 +259,7 @@ , "inputs": { "type": "map_union" , "$1": - [ {"type": "var", "name": "attempts"} + [ {"type": "var", "name": "attempts (for summary)"} , {"type": "var", "name": "summarizer"} ] } @@ -225,6 +273,20 @@ } } ] + , [ "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": diff --git a/shell/test/TARGETS b/shell/test/TARGETS index 0967ef4..5a4b849 100644 --- a/shell/test/TARGETS +++ b/shell/test/TARGETS @@ -1 +1,6 @@ -{} +{ "summarizer": + { "type": "summarizer" + , "summarizer": [["FILE", null, "summarizer"]] + , "artifacts": ["time-start", "time-stop"] + } +} |