diff options
-rw-r--r-- | rules/CC/EXPRESSIONS | 1 | ||||
-rw-r--r-- | rules/CC/test/EXPRESSIONS | 19 | ||||
-rw-r--r-- | rules/CC/test/RULES | 20 | ||||
-rw-r--r-- | rules/lint/RULES | 3 | ||||
-rw-r--r-- | rules/shell/test/EXPRESSIONS | 2 | ||||
-rw-r--r-- | rules/shell/test/RULES | 16 | ||||
-rw-r--r-- | rules/test/RULES | 45 |
7 files changed, 103 insertions, 3 deletions
diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS index 56d5c31..7d5310e 100644 --- a/rules/CC/EXPRESSIONS +++ b/rules/CC/EXPRESSIONS @@ -1086,6 +1086,7 @@ , "lint-deps fieldnames" , "deps-transition" , "compile-args" + , "defaults-transition" ] , "imports": { "objects": "objects" diff --git a/rules/CC/test/EXPRESSIONS b/rules/CC/test/EXPRESSIONS index 27d92f3..b12b80d 100644 --- a/rules/CC/test/EXPRESSIONS +++ b/rules/CC/test/EXPRESSIONS @@ -39,6 +39,7 @@ , "test-data" , "summarizer" , "summary artifacts" + , "LINT" ] , "imports": { "artifacts": ["./", "../..", "field_artifacts"] @@ -56,6 +57,7 @@ , "target properties": ["transitions", "target properties"] , "stage": ["./", "../..", "stage_singleton_field"] , "list_provider": ["./", "../..", "field_list_provider"] + , "lint": ["./", "..", "lint information"] } , "expression": { "type": "let*" @@ -96,6 +98,21 @@ , {"type": "CALL_EXPRESSION", "name": "run-libs-args-deps"} ] , ["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": @@ -212,6 +229,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "test-results"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } , "then": @@ -386,6 +404,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "artifacts"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } } diff --git a/rules/CC/test/RULES b/rules/CC/test/RULES index 244bca0..3401974 100644 --- a/rules/CC/test/RULES +++ b/rules/CC/test/RULES @@ -31,6 +31,7 @@ , "RUNS_PER_TEST" , "ARCH_DISPATCH" , "TEST_SUMMARY_EXECUTION_PROPERTIES" + , "LINT" ] , "implicit": { "defaults": [["./", "..", "defaults"]] @@ -151,6 +152,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" @@ -178,6 +184,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"}] } @@ -197,12 +205,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"} } } @@ -212,12 +224,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"]] diff --git a/rules/lint/RULES b/rules/lint/RULES index d7b2703..7e2861c 100644 --- a/rules/lint/RULES +++ b/rules/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"}} ] diff --git a/rules/shell/test/EXPRESSIONS b/rules/shell/test/EXPRESSIONS index b58bb49..9791911 100644 --- a/rules/shell/test/EXPRESSIONS +++ b/rules/shell/test/EXPRESSIONS @@ -354,6 +354,7 @@ , "deps-fieldname" , "deps-transition" , "target properties" + , "lint" ] , "imports": {"action": "test-action"} , "expression": @@ -372,6 +373,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "test-results"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } } diff --git a/rules/shell/test/RULES b/rules/shell/test/RULES index a808575..1c069dc 100644 --- a/rules/shell/test/RULES +++ b/rules/shell/test/RULES @@ -38,6 +38,7 @@ , "TARGET_ARCH" , "ARCH_DISPATCH" , "TEST_SUMMARY_EXECUTION_PROPERTIES" + , "LINT" ] , "field_doc": { "test": @@ -191,6 +192,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" @@ -343,6 +358,7 @@ { "type": "RESULT" , "artifacts": {"type": "var", "name": "artifacts"} , "runfiles": {"type": "var", "name": "runfiles"} + , "provides": {"type": "env", "vars": ["lint"]} } } } diff --git a/rules/test/RULES b/rules/test/RULES new file mode 100644 index 0000000..9fb11e3 --- /dev/null +++ b/rules/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"]} + } + } + } +} |