diff options
-rw-r--r-- | CC/test/EXPRESSIONS | 10 | ||||
-rw-r--r-- | CC/test/RULES | 19 | ||||
-rw-r--r-- | transitions/EXPRESSIONS | 44 |
3 files changed, 72 insertions, 1 deletions
diff --git a/CC/test/EXPRESSIONS b/CC/test/EXPRESSIONS index e1442c5..0c6d797 100644 --- a/CC/test/EXPRESSIONS +++ b/CC/test/EXPRESSIONS @@ -8,6 +8,8 @@ , "vars": [ "ARCH" , "HOST_ARCH" + , "TARGET_ARCH" + , "ARCH_DISPATCH" , "CC" , "CXX" , "CFLAGS" @@ -48,6 +50,7 @@ , "ldflags-files-deps": ["./", "..", "ldflags-files-deps"] , "binary": ["./", "..", "bin artifact"] , "host transition": ["transitions", "for host"] + , "target properties": ["transitions", "target properties"] , "stage": ["./", "../..", "stage_singleton_field"] } , "expression": @@ -154,6 +157,9 @@ ] } ] + , [ "target properties" + , {"type": "CALL_EXPRESSION", "name": "target properties"} + ] ] , "body": { "type": "if" @@ -178,6 +184,8 @@ , "$1": ["CC test ", {"type": "var", "name": "test-name"}, " failed"] } + , "execution properties": + {"type": "var", "name": "target properties"} } ] , [ "runfiles" @@ -251,6 +259,8 @@ , ")" ] } + , "execution properties": + {"type": "var", "name": "target properties"} } } } diff --git a/CC/test/RULES b/CC/test/RULES index 8a985be..a1f4bfb 100644 --- a/CC/test/RULES +++ b/CC/test/RULES @@ -14,6 +14,7 @@ , "config_vars": [ "ARCH" , "HOST_ARCH" + , "TARGET_ARCH" , "CC" , "CXX" , "CFLAGS" @@ -27,6 +28,7 @@ , "TEST_ENV" , "CC_TEST_LAUNCHER" , "RUNS_PER_TEST" + , "ARCH_DISPATCH" ] , "implicit": { "defaults": [["./", "..", "defaults"]] @@ -99,6 +101,19 @@ [ "The number of times the test should be run in order to detect flakyness." , "If set, no test action will be taken from cache." ] + , "TARGET_ARCH": + [ "The architecture to build the test for." + , "" + , "Will only be honored, if that architecture is available in the" + , "ARCH_DISPATCH map. Otherwise, the test will be built for and run" + , "on the host architecture." + ] + , "ARCH_DISPATCH": + [ "Map of architectures to execution properties that ensure execution" + , "on that architecture. Only the actual test binary will be run with" + , "the specified execution properties (i.e., on the target architecture);" + , "all building will be done on the host architecture." + ] } , "artifacts_doc": [ "result: the result of this test (\"PASS\" or \"FAIL\"); useful for" @@ -117,7 +132,7 @@ , "imports": { "artifacts": ["./", "../..", "field_artifacts"] , "runfiles": ["./", "../..", "field_runfiles"] - , "host transition": ["transitions", "for host"] + , "host transition": ["transitions", "maybe for host"] , "stage": ["./", "../..", "stage_singleton_field"] , "run_test": "run_test" } @@ -125,6 +140,7 @@ { "defaults": [{"type": "CALL_EXPRESSION", "name": "host transition"}] , "private-deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}] , "data": [{"type": "CALL_EXPRESSION", "name": "host transition"}] + , "runner": [{"type": "CALL_EXPRESSION", "name": "host transition"}] } , "expression": { "type": "let*" @@ -182,6 +198,7 @@ , "$1": { "type": "DEP_ARTIFACTS" , "dep": {"type": "var", "name": "runner"} + , "transition": {"type": "var", "name": "host-trans"} } } , "body": diff --git a/transitions/EXPRESSIONS b/transitions/EXPRESSIONS index 92be685..db401a0 100644 --- a/transitions/EXPRESSIONS +++ b/transitions/EXPRESSIONS @@ -26,4 +26,48 @@ , "else": {"type": "empty_map"} } } +, "target properties": + { "vars": ["ARCH", "TARGET_ARCH", "ARCH_DISPATCH"] + , "expression": + { "type": "let*" + , "bindings": + [ [ "TARGET_ARCH" + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + ] + , "body": + { "type": "if" + , "cond": + { "type": "==" + , "$1": {"type": "var", "name": "TARGET_ARCH"} + , "$2": null + } + , "then": {"type": "empty_map"} + , "else": + { "type": "lookup" + , "map": + { "type": "var" + , "name": "ARCH_DISPATCH" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "TARGET_ARCH"} + , "default": {"type": "empty_map"} + } + } + } + } +, "maybe for host": + { "vars": ["ARCH", "HOST_ARCH", "TARGET_ARCH", "ARCH_DISPATCH"] + , "imports": + {"target properties": "target properties", "for host": "for host"} + , "expression": + { "type": "if" + , "cond": {"type": "CALL_EXPRESSION", "name": "target properties"} + , "then": {"type": "empty_map"} + , "else": {"type": "CALL_EXPRESSION", "name": "for host"} + } + } } |