From 2df55f5c3522e52bf6444ed561667ef42c2d0d25 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 14 Aug 2024 16:18:55 +0200 Subject: ["lint", "targets"]: deduplicate tasks In case many "targets" are given, the field "lint" will contain all the concatenation of the provider "lint" of the given targets. There is, however, not need to lint the same file in the same context twice, so deduplicate the targets first. While this does not change the amount of lint actions carried out (as equal actions are handled only once anyway), it keeps the summary clean by not having dulicate entries. --- lint/RULES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lint/RULES b/lint/RULES index d7b2703..7e2861c 100644 --- a/lint/RULES +++ b/lint/RULES @@ -133,6 +133,9 @@ } } ] + , [ "lint results" + , {"type": "nub_right", "$1": {"type": "var", "name": "lint results"}} + ] , [ "summary input" , {"type": "enumerate", "$1": {"type": "var", "name": "lint results"}} ] -- cgit v1.2.3 From f6ea71cda4785287996d819e2817e9cd35e2e664 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 14 Aug 2024 15:48:06 +0200 Subject: ["CC", "test"]: support providing lint information While there, also properly transition "srcs" and "private-hdrs" to the host version. --- CC/EXPRESSIONS | 1 + CC/test/EXPRESSIONS | 19 +++++++++++++++++++ CC/test/RULES | 20 +++++++++++++++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index ebe4017..2413f98 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -815,6 +815,7 @@ , "lint-deps fieldnames" , "deps-transition" , "compile-args" + , "defaults-transition" ] , "imports": { "objects": "objects" diff --git a/CC/test/EXPRESSIONS b/CC/test/EXPRESSIONS index f3e4b04..b42401b 100644 --- a/CC/test/EXPRESSIONS +++ b/CC/test/EXPRESSIONS @@ -39,6 +39,7 @@ , "test-data" , "summarizer" , "summary artifacts" + , "LINT" ] , "imports": { "artifacts": ["./", "../..", "field_artifacts"] @@ -53,6 +54,7 @@ , "host transition": ["transitions", "for host"] , "target properties": ["transitions", "target properties"] , "stage": ["./", "../..", "stage_singleton_field"] + , "lint": ["./", "..", "lint information"] } , "expression": { "type": "let*" @@ -89,6 +91,21 @@ } ] , ["binary", {"type": "CALL_EXPRESSION", "name": "binary"}] + , [ "lint" + , { "type": "if" + , "cond": {"type": "var", "name": "LINT"} + , "then": + { "type": "let*" + , "bindings": + [ ["hdrs", {"type": "empty_map"}] + , [ "lint-deps fieldnames" + , ["private-hdrs", "srcs", "private-deps"] + ] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "lint"} + } + } + ] , [ "staged test binary" , { "type": "map_union" , "$1": @@ -204,6 +221,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "test-results"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } , "then": @@ -357,6 +375,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "artifacts"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } } diff --git a/CC/test/RULES b/CC/test/RULES index f61d9f7..c0d54b5 100644 --- a/CC/test/RULES +++ b/CC/test/RULES @@ -28,6 +28,7 @@ , "RUNS_PER_TEST" , "ARCH_DISPATCH" , "TEST_SUMMARY_EXECUTION_PROPERTIES" + , "LINT" ] , "implicit": { "defaults": [["./", "..", "defaults"]] @@ -136,6 +137,11 @@ [ "Additional remote-execution properties for the test-summarizing action" , "in case RUNS_PER_TEST is set; defaults to the empty map." ] + , "LINT": + [ "Also provide nodes describing compile actions and header files;" + , "those can be used by lint rules (doing also the config transition)" + , "for additional checks." + ] } , "artifacts_doc": [ "result: the result of this test (\"PASS\" or \"FAIL\"); useful for" @@ -163,6 +169,8 @@ , "config_transitions": { "defaults": [{"type": "CALL_EXPRESSION", "name": "host transition"}] , "private-deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}] + , "private-hdrs": [{"type": "CALL_EXPRESSION", "name": "host transition"}] + , "srcs": [{"type": "CALL_EXPRESSION", "name": "host transition"}] , "data": [{"type": "CALL_EXPRESSION", "name": "host transition"}] , "runner": [{"type": "CALL_EXPRESSION", "name": "host transition"}] } @@ -182,12 +190,16 @@ , "$1": {"type": "FIELD", "name": "stage"} } ] + , ["host-trans", {"type": "CALL_EXPRESSION", "name": "host transition"}] , [ "srcs" , { "type": "to_subdir" , "subdir": {"type": "var", "name": "stage"} , "$1": { "type": "let*" - , "bindings": [["fieldname", "srcs"]] + , "bindings": + [ ["fieldname", "srcs"] + , ["transition", {"type": "var", "name": "host-trans"}] + ] , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"} } } @@ -197,12 +209,14 @@ , "subdir": {"type": "var", "name": "stage"} , "$1": { "type": "let*" - , "bindings": [["fieldname", "private-hdrs"]] + , "bindings": + [ ["fieldname", "private-hdrs"] + , ["transition", {"type": "var", "name": "host-trans"}] + ] , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"} } } ] - , ["host-trans", {"type": "CALL_EXPRESSION", "name": "host transition"}] , ["defaults-transition", {"type": "var", "name": "host-trans"}] , ["deps-transition", {"type": "var", "name": "host-trans"}] , ["deps-fieldnames", ["private-deps", "defaults"]] -- cgit v1.2.3 From 731716280761ced876ddd5e4dd0a6818b0b106f8 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 20 Aug 2024 16:23:11 +0200 Subject: ["shell/test", "script"] forward lint information of deps --- shell/test/EXPRESSIONS | 2 ++ shell/test/RULES | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS index 44cb48a..c4e0a3c 100644 --- a/shell/test/EXPRESSIONS +++ b/shell/test/EXPRESSIONS @@ -272,6 +272,7 @@ , "deps-fieldname" , "deps-transition" , "target properties" + , "lint" ] , "imports": {"action": "test-action"} , "expression": @@ -290,6 +291,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "test-results"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } } diff --git a/shell/test/RULES b/shell/test/RULES index 5d83e1d..98fdab0 100644 --- a/shell/test/RULES +++ b/shell/test/RULES @@ -38,6 +38,7 @@ , "TARGET_ARCH" , "ARCH_DISPATCH" , "TEST_SUMMARY_EXECUTION_PROPERTIES" + , "LINT" ] , "field_doc": { "test": @@ -186,6 +187,20 @@ , [ "target properties" , {"type": "CALL_EXPRESSION", "name": "target properties"} ] + , [ "lint" + , { "type": "if" + , "cond": {"type": "var", "name": "LINT"} + , "then": + { "type": "let*" + , "bindings": + [ ["fieldname", "deps"] + , ["provider", "lint"] + , ["transition", {"type": "var", "name": "deps-transition"}] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "field_list"} + } + } + ] ] , "body": { "type": "if" @@ -322,6 +337,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "artifacts"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } } -- cgit v1.2.3 From 22534d3549a0584c889085594d7ab14cf6e8d44c Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 14 Aug 2024 17:19:10 +0200 Subject: Add ["test", "suite"] ... collecting test results similar to the way "install" rules are typically used; however in such a way that the provider "lint" is forwarded. --- test/RULES | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/RULES diff --git a/test/RULES b/test/RULES new file mode 100644 index 0000000..9fb11e3 --- /dev/null +++ b/test/RULES @@ -0,0 +1,45 @@ +{ "suite": + { "doc": + [ "Form a compound target out of many test targets." + , "" + , "More precisely, take the runfiles of the given \"deps\", take their" + , "disjoint union and stage the result. Also propagate relevant" + , "providers." + ] + , "tainted": ["test"] + , "target_fields": ["deps"] + , "string_fields": ["stage"] + , "imports": + { "runfiles": ["", "field_runfiles"] + , "list_provider": ["", "field_list_provider"] + } + , "expression": + { "type": "let*" + , "bindings": + [ ["fieldname", "deps"] + , ["runfiles", {"type": "CALL_EXPRESSION", "name": "runfiles"}] + , [ "stage" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "FIELD", "name": "stage"} + } + ] + , [ "staged results" + , { "type": "to_subdir" + , "subdir": {"type": "var", "name": "stage"} + , "$1": {"type": "var", "name": "runfiles"} + } + ] + , ["provider", "lint"] + , ["lint", {"type": "CALL_EXPRESSION", "name": "list_provider"}] + , ["lint", {"type": "nub_right", "$1": {"type": "var", "name": "lint"}}] + ] + , "body": + { "type": "RESULT" + , "artifacts": {"type": "var", "name": "staged results"} + , "runfiles": {"type": "var", "name": "staged results"} + , "provides": {"type": "env", "vars": ["lint"]} + } + } + } +} -- cgit v1.2.3