[test-env] Expose test environments to (hermetic_)tests_package
Needed so that callers can specify environments.
See bug for context.
Bug: IN-927 #comment
Test: CQ
Change-Id: Ic6d2bc62413b39099d7babc5d4f420eb3a67b05b
diff --git a/build/tests_package.gni b/build/tests_package.gni
index 34190a2..63018e7 100644
--- a/build/tests_package.gni
+++ b/build/tests_package.gni
@@ -8,12 +8,22 @@
# A variant of package() that only contains test executables. The test
# executables are specified as the build products of the deps. A tests_package()
# is always testonly = true. The deps are expected to be executable()s.
+#
+# Additional parameters
+#
+# environments (optional, default: [ { dimensions = { device_type = "QEMU" } } ])
+# [list of scopes] Device environments in which the tests should run. See
+# //build/package.gni for more details.
+#
template("tests_package") {
computed_tests = []
foreach(dep, invoker.deps) {
computed_tests += [
{
name = get_label_info(dep, "name")
+ if (defined(invoker.environments)) {
+ environments = invoker.environments
+ }
},
]
}
@@ -37,12 +47,23 @@
# This variant, as described in
# https://fuchsia.git.corp.google.com/docs/+/master/development/tests/test_component.md,
# requires a .cmx file for each test.
+#
+#
+# Additional parameters
+#
+# environments (optional, default: [ { dimensions = { device_type = "QEMU" } } ])
+# [list of scopes] Device environments in which the tests should run. See
+# //build/package.gni for more details.
+#
template("hermetic_tests_package") {
computed_tests = []
foreach(dep, invoker.deps) {
computed_tests += [
{
name = get_label_info(dep, "name")
+ if (defined(invoker.environments)) {
+ environments = invoker.environments
+ }
},
]
}