summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-07-13 11:13:27 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-07-14 09:36:51 +0200
commit9b6723844d1063459d27d3610284a5226b946cfe (patch)
tree2f2d1978e683478678306c31466aa0d46c3b5a39
parentaa14a481ce7645f6fb78ce7548a1f60920599d49 (diff)
downloadrules-cc-9b6723844d1063459d27d3610284a5226b946cfe.tar.gz
["shell/test", "script"]: support target architecture
... provided it is specified on how to obtain a remote-execution endpoint for the given architecture; in this case, the test (script and) dependencies will be cross compiled for and run on that architecture. The actual building (as well as summarizing multiple test runs) happens on the default execution end point.
-rw-r--r--shell/test/EXPRESSIONS4
-rw-r--r--shell/test/RULES40
2 files changed, 40 insertions, 4 deletions
diff --git a/shell/test/EXPRESSIONS b/shell/test/EXPRESSIONS
index 3ab3605..80e6cdb 100644
--- a/shell/test/EXPRESSIONS
+++ b/shell/test/EXPRESSIONS
@@ -9,6 +9,7 @@
, "runner"
, "deps-fieldname"
, "deps-transition"
+ , "target properties"
]
, "imports":
{ "artifacts_list": ["./", "../..", "field_artifacts_list"]
@@ -135,6 +136,7 @@
}
, "timeout scaling":
{"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0}
+ , "execution properties": {"type": "var", "name": "target properties"}
}
, "else":
{ "type": "ACTION"
@@ -156,6 +158,7 @@
}
, "timeout scaling":
{"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0}
+ , "execution properties": {"type": "var", "name": "target properties"}
}
}
}
@@ -170,6 +173,7 @@
, "runner"
, "deps-fieldname"
, "deps-transition"
+ , "target properties"
]
, "imports": {"action": "test-action"}
, "expression":
diff --git a/shell/test/RULES b/shell/test/RULES
index d6baa9c..117a060 100644
--- a/shell/test/RULES
+++ b/shell/test/RULES
@@ -3,7 +3,14 @@
, "target_fields": ["deps", "test"]
, "string_fields": ["keep", "name"]
, "config_vars":
- ["ARCH", "HOST_ARCH", "RUNS_PER_TEST", "TEST_ENV", "TIMEOUT_SCALE"]
+ [ "ARCH"
+ , "HOST_ARCH"
+ , "RUNS_PER_TEST"
+ , "TEST_ENV"
+ , "TIMEOUT_SCALE"
+ , "TARGET_ARCH"
+ , "ARCH_DISPATCH"
+ ]
, "field_doc":
{ "test":
[ "The shell script for the test, launched with sh."
@@ -36,6 +43,19 @@
, "TEST_ENV": ["The environment for executing the test runner."]
, "TIMEOUT_SCALE":
["Factor on how to scale the timeout for this test. Defaults to 1.0."]
+ , "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."
+ ]
}
, "tainted": ["test"]
, "artifacts_doc":
@@ -58,10 +78,13 @@
{ "test-result": "test-result"
, "action": "test-action"
, "stage": ["./", "../..", "stage_singleton_field"]
- , "host transition": ["transitions", "for host"]
+ , "host transition": ["transitions", "maybe for host"]
+ , "target properties": ["transitions", "target properties"]
}
, "config_transitions":
- {"deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}]}
+ { "deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
+ , "test": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
+ }
, "expression":
{ "type": "let*"
, "bindings":
@@ -70,7 +93,13 @@
, "msg": "Expecting 'test' to specify precisely one file containing a shell script"
, "$1":
{ "type": "let*"
- , "bindings": [["fieldname", "test"], ["location", "test.sh"]]
+ , "bindings":
+ [ ["fieldname", "test"]
+ , ["location", "test.sh"]
+ , [ "transition"
+ , {"type": "CALL_EXPRESSION", "name": "host transition"}
+ ]
+ ]
, "body": {"type": "CALL_EXPRESSION", "name": "stage"}
}
}
@@ -87,6 +116,9 @@
, [ "deps-transition"
, {"type": "CALL_EXPRESSION", "name": "host transition"}
]
+ , [ "target properties"
+ , {"type": "CALL_EXPRESSION", "name": "target properties"}
+ ]
]
, "body":
{ "type": "if"