Add android_test_helper_app
Add a module that can build an APK that will be used by a test. The APK will be sideloadable, and can be added to a test suite, but will not autogenerate a test config file. Test: m checkbuild Change-Id: Idf325b1c9a2cbcd16b126da3331671e4aed4b3da
This commit is contained in:
@@ -271,6 +271,21 @@ func (a *AndroidTest) AndroidMk() android.AndroidMkData {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AndroidTestHelperApp) AndroidMk() android.AndroidMkData {
|
||||||
|
data := a.AndroidApp.AndroidMk()
|
||||||
|
data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
|
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests")
|
||||||
|
if len(a.appTestHelperAppProperties.Test_suites) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
|
||||||
|
strings.Join(a.appTestHelperAppProperties.Test_suites, " "))
|
||||||
|
} else {
|
||||||
|
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE := null-suite")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AndroidLibrary) AndroidMk() android.AndroidMkData {
|
func (a *AndroidLibrary) AndroidMk() android.AndroidMkData {
|
||||||
data := a.Library.AndroidMk()
|
data := a.Library.AndroidMk()
|
||||||
|
|
||||||
|
34
java/app.go
34
java/app.go
@@ -30,6 +30,7 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
android.RegisterModuleType("android_app", AndroidAppFactory)
|
android.RegisterModuleType("android_app", AndroidAppFactory)
|
||||||
android.RegisterModuleType("android_test", AndroidTestFactory)
|
android.RegisterModuleType("android_test", AndroidTestFactory)
|
||||||
|
android.RegisterModuleType("android_test_helper_app", AndroidTestHelperAppFactory)
|
||||||
android.RegisterModuleType("android_app_certificate", AndroidAppCertificateFactory)
|
android.RegisterModuleType("android_app_certificate", AndroidAppCertificateFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,6 +360,39 @@ func AndroidTestFactory() android.Module {
|
|||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type appTestHelperAppProperties struct {
|
||||||
|
// list of compatibility suites (for example "cts", "vts") that the module should be
|
||||||
|
// installed into.
|
||||||
|
Test_suites []string `android:"arch_variant"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AndroidTestHelperApp struct {
|
||||||
|
AndroidApp
|
||||||
|
|
||||||
|
appTestHelperAppProperties appTestHelperAppProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
func AndroidTestHelperAppFactory() android.Module {
|
||||||
|
module := &AndroidTestHelperApp{}
|
||||||
|
|
||||||
|
module.Module.deviceProperties.Optimize.Enabled = proptools.BoolPtr(true)
|
||||||
|
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
module.appProperties.EmbedJNI = true
|
||||||
|
|
||||||
|
module.AddProperties(
|
||||||
|
&module.Module.properties,
|
||||||
|
&module.Module.deviceProperties,
|
||||||
|
&module.Module.protoProperties,
|
||||||
|
&module.aaptProperties,
|
||||||
|
&module.appProperties,
|
||||||
|
&module.appTestHelperAppProperties)
|
||||||
|
|
||||||
|
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||||
|
android.InitDefaultableModule(module)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
|
||||||
type AndroidAppCertificate struct {
|
type AndroidAppCertificate struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
properties AndroidAppCertificateProperties
|
properties AndroidAppCertificateProperties
|
||||||
|
Reference in New Issue
Block a user