Give cc_test rule information to determine the test types
There are three types of tests, deviceless tests, device-driven tests
and host-driven device tests. But currently we don't have information
to get the type of a test and can't generate test targets on desired
types.
Test: b test //platform_testing/tests/example/native:hello_world_test
Test: b test //packages/modules/adb:adbd_test
Bug: 296312548
Change-Id: I3f022ef769636d508e055477623a4d1a6a1d9044
diff --git a/android/bazel.go b/android/bazel.go
index e4fada0..94b36e3 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -689,3 +689,21 @@
})
return validatedOutputFilePath
}
+
+func RunsOn(hostSupported bool, deviceSupported bool, unitTest bool) []string {
+ var runsOn []string
+
+ if hostSupported && deviceSupported {
+ runsOn = []string{"host_without_device", "device"}
+ } else if hostSupported {
+ if unitTest {
+ runsOn = []string{"host_without_device"}
+ } else {
+ runsOn = []string{"host_with_device"}
+ }
+ } else if deviceSupported {
+ runsOn = []string{"device"}
+ }
+
+ return runsOn
+}