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
This commit is contained in:
yike
2023-08-17 01:03:37 +00:00
parent b0e1035417
commit fdca7fe03b
3 changed files with 47 additions and 0 deletions

View File

@@ -689,3 +689,21 @@ func AttachValidationActions(ctx ModuleContext, outputFilePath Path, validations
})
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
}