Merge "Remove extra return value from testApex" am: 110bca5bd1 am: f686c21c3b am: bbf3dcf9ec

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1590978

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0e904bf0966fcf1f402daeba5b79486d725c5b35
This commit is contained in:
Colin Cross 2021-03-08 20:15:03 +00:00 committed by Automerger Merge Worker
commit cbd14768a4
3 changed files with 104 additions and 104 deletions

View File

@ -67,14 +67,14 @@ func testApexError(t *testing.T, pattern, bp string, handlers ...testCustomizer)
t.Fatalf("missing expected error %q (0 errors are returned)", pattern) t.Fatalf("missing expected error %q (0 errors are returned)", pattern)
} }
func testApex(t *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) { func testApex(t *testing.T, bp string, handlers ...testCustomizer) *android.TestContext {
t.Helper() t.Helper()
ctx, config := testApexContext(t, bp, handlers...) ctx, config := testApexContext(t, bp, handlers...)
_, errs := ctx.ParseBlueprintsFiles(".") _, errs := ctx.ParseBlueprintsFiles(".")
android.FailIfErrored(t, errs) android.FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config) _, errs = ctx.PrepareBuildActions(config)
android.FailIfErrored(t, errs) android.FailIfErrored(t, errs)
return ctx, config return ctx
} }
type testCustomizer func(fs map[string][]byte, config android.Config) type testCustomizer func(fs map[string][]byte, config android.Config)
@ -360,7 +360,7 @@ func ensureListNotEmpty(t *testing.T, result []string) {
// Minimal test // Minimal test
func TestBasicApex(t *testing.T) { func TestBasicApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_defaults { apex_defaults {
name: "myapex-defaults", name: "myapex-defaults",
manifest: ":myapex.manifest", manifest: ":myapex.manifest",
@ -666,7 +666,7 @@ func TestBasicApex(t *testing.T) {
} }
func TestDefaults(t *testing.T) { func TestDefaults(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_defaults { apex_defaults {
name: "myapex-defaults", name: "myapex-defaults",
key: "myapex.key", key: "myapex.key",
@ -741,7 +741,7 @@ func TestDefaults(t *testing.T) {
} }
func TestApexManifest(t *testing.T) { func TestApexManifest(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -763,7 +763,7 @@ func TestApexManifest(t *testing.T) {
} }
func TestBasicZipApex(t *testing.T) { func TestBasicZipApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -814,7 +814,7 @@ func TestBasicZipApex(t *testing.T) {
} }
func TestApexWithStubs(t *testing.T) { func TestApexWithStubs(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -909,7 +909,7 @@ func TestApexWithStubs(t *testing.T) {
func TestApexWithStubsWithMinSdkVersion(t *testing.T) { func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
t.Parallel() t.Parallel()
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1016,7 +1016,7 @@ func TestApex_PlatformUsesLatestStubFromApex(t *testing.T) {
// | // |
// <platform> | // <platform> |
// libplatform ----------------' // libplatform ----------------'
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1081,7 +1081,7 @@ func TestApex_PlatformUsesLatestStubFromApex(t *testing.T) {
} }
func TestApexWithExplicitStubsDependency(t *testing.T) { func TestApexWithExplicitStubsDependency(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex2", name: "myapex2",
key: "myapex2.key", key: "myapex2.key",
@ -1177,7 +1177,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
| |
`------> libbar `------> libbar
*/ */
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1239,7 +1239,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
} }
func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) { func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) { ctx := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := ` bp := `
apex { apex {
name: "com.android.runtime", name: "com.android.runtime",
@ -1303,7 +1303,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
} }
func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) { func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) { ctx := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := ` bp := `
apex { apex {
name: "com.android.runtime", name: "com.android.runtime",
@ -1389,7 +1389,7 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
} }
for _, tc := range testcases { for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1456,7 +1456,7 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
} }
func TestApexWithSystemLibsStubs(t *testing.T) { func TestApexWithSystemLibsStubs(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1552,7 +1552,7 @@ func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T)
// 1) myapex -> libx -> liba -> libz : this should be #30 link // 1) myapex -> libx -> liba -> libz : this should be #30 link
// 2) otherapex -> liby -> liba -> libz : this should be #30 link // 2) otherapex -> liby -> liba -> libz : this should be #30 link
// 3) (platform) -> liba -> libz : this should be non-stub link // 3) (platform) -> liba -> libz : this should be non-stub link
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1634,7 +1634,7 @@ func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T)
} }
func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) { func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1683,7 +1683,7 @@ func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
} }
func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) { func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1729,7 +1729,7 @@ func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
} }
func TestPlatformUsesLatestStubsFromApexes(t *testing.T) { func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1777,7 +1777,7 @@ func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
} }
func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) { func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -1816,7 +1816,7 @@ func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
} }
func TestQTargetApexUsesStaticUnwinder(t *testing.T) { func TestQTargetApexUsesStaticUnwinder(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2143,7 +2143,7 @@ func TestApexMinSdkVersion_ErrorIfDepIsNewer_Java(t *testing.T) {
} }
func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion(t *testing.T) { func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2230,7 +2230,7 @@ func TestApexMinSdkVersion_WorksWithActiveCodenames(t *testing.T) {
config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("S") config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("S")
config.TestProductVariables.Platform_version_active_codenames = []string{"S", "T"} config.TestProductVariables.Platform_version_active_codenames = []string{"S", "T"}
} }
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2264,7 +2264,7 @@ func TestApexMinSdkVersion_WorksWithActiveCodenames(t *testing.T) {
} }
func TestFilesInSubDir(t *testing.T) { func TestFilesInSubDir(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2327,7 +2327,7 @@ func TestFilesInSubDir(t *testing.T) {
} }
func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) { func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2386,7 +2386,7 @@ func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
} }
func TestUseVendor(t *testing.T) { func TestUseVendor(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2499,7 +2499,7 @@ func TestUseVendorFailsIfNotVendorAvailable(t *testing.T) {
} }
func TestVendorApex(t *testing.T) { func TestVendorApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2546,7 +2546,7 @@ func TestVendorApex(t *testing.T) {
} }
func TestVendorApex_use_vndk_as_stable(t *testing.T) { func TestVendorApex_use_vndk_as_stable(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2610,7 +2610,7 @@ func TestApex_withPrebuiltFirmware(t *testing.T) {
} }
for _, tc := range testCases { for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2638,7 +2638,7 @@ func TestApex_withPrebuiltFirmware(t *testing.T) {
} }
func TestAndroidMk_UseVendorRequired(t *testing.T) { func TestAndroidMk_UseVendorRequired(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2673,7 +2673,7 @@ func TestAndroidMk_UseVendorRequired(t *testing.T) {
} }
func TestAndroidMk_VendorApexRequired(t *testing.T) { func TestAndroidMk_VendorApexRequired(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2705,7 +2705,7 @@ func TestAndroidMk_VendorApexRequired(t *testing.T) {
} }
func TestAndroidMkWritesCommonProperties(t *testing.T) { func TestAndroidMkWritesCommonProperties(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2735,7 +2735,7 @@ func TestAndroidMkWritesCommonProperties(t *testing.T) {
} }
func TestStaticLinking(t *testing.T) { func TestStaticLinking(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2780,7 +2780,7 @@ func TestStaticLinking(t *testing.T) {
} }
func TestKeys(t *testing.T) { func TestKeys(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex_keytest", name: "myapex_keytest",
key: "myapex.key", key: "myapex.key",
@ -2838,7 +2838,7 @@ func TestKeys(t *testing.T) {
func TestCertificate(t *testing.T) { func TestCertificate(t *testing.T) {
t.Run("if unspecified, it defaults to DefaultAppCertificate", func(t *testing.T) { t.Run("if unspecified, it defaults to DefaultAppCertificate", func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2856,7 +2856,7 @@ func TestCertificate(t *testing.T) {
} }
}) })
t.Run("override when unspecified", func(t *testing.T) { t.Run("override when unspecified", func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex_keytest", name: "myapex_keytest",
key: "myapex.key", key: "myapex.key",
@ -2879,7 +2879,7 @@ func TestCertificate(t *testing.T) {
} }
}) })
t.Run("if specified as :module, it respects the prop", func(t *testing.T) { t.Run("if specified as :module, it respects the prop", func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2902,7 +2902,7 @@ func TestCertificate(t *testing.T) {
} }
}) })
t.Run("override when specifiec as <:module>", func(t *testing.T) { t.Run("override when specifiec as <:module>", func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex_keytest", name: "myapex_keytest",
key: "myapex.key", key: "myapex.key",
@ -2926,7 +2926,7 @@ func TestCertificate(t *testing.T) {
} }
}) })
t.Run("if specified as name, finds it from DefaultDevKeyDir", func(t *testing.T) { t.Run("if specified as name, finds it from DefaultDevKeyDir", func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2945,7 +2945,7 @@ func TestCertificate(t *testing.T) {
} }
}) })
t.Run("override when specified as <name>", func(t *testing.T) { t.Run("override when specified as <name>", func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex_keytest", name: "myapex_keytest",
key: "myapex.key", key: "myapex.key",
@ -2971,7 +2971,7 @@ func TestCertificate(t *testing.T) {
} }
func TestMacro(t *testing.T) { func TestMacro(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -3099,7 +3099,7 @@ func TestMacro(t *testing.T) {
} }
func TestHeaderLibsDependency(t *testing.T) { func TestHeaderLibsDependency(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -3243,7 +3243,7 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName, var
} }
func TestVndkApexCurrent(t *testing.T) { func TestVndkApexCurrent(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.current",
key: "com.android.vndk.current.key", key: "com.android.vndk.current.key",
@ -3300,7 +3300,7 @@ func TestVndkApexCurrent(t *testing.T) {
} }
func TestVndkApexWithPrebuilt(t *testing.T) { func TestVndkApexWithPrebuilt(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.current",
key: "com.android.vndk.current.key", key: "com.android.vndk.current.key",
@ -3384,7 +3384,7 @@ func vndkLibrariesTxtFiles(vers ...string) (result string) {
} }
func TestVndkApexVersion(t *testing.T) { func TestVndkApexVersion(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.v27", name: "com.android.vndk.v27",
key: "myapex.key", key: "myapex.key",
@ -3453,7 +3453,7 @@ func TestVndkApexVersion(t *testing.T) {
} }
func TestVndkApexNameRule(t *testing.T) { func TestVndkApexNameRule(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.current",
key: "myapex.key", key: "myapex.key",
@ -3486,7 +3486,7 @@ func TestVndkApexNameRule(t *testing.T) {
} }
func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.current",
key: "com.android.vndk.current.key", key: "com.android.vndk.current.key",
@ -3558,7 +3558,7 @@ func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
} }
func TestVndkApexWithBinder32(t *testing.T) { func TestVndkApexWithBinder32(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.v27", name: "com.android.vndk.v27",
key: "myapex.key", key: "myapex.key",
@ -3627,7 +3627,7 @@ func TestVndkApexWithBinder32(t *testing.T) {
} }
func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.current",
key: "com.android.vndk.current.key", key: "com.android.vndk.current.key",
@ -3663,7 +3663,7 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
} }
func TestDependenciesInApexManifest(t *testing.T) { func TestDependenciesInApexManifest(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex_nodep", name: "myapex_nodep",
key: "myapex.key", key: "myapex.key",
@ -3771,7 +3771,7 @@ func TestDependenciesInApexManifest(t *testing.T) {
} }
func TestApexName(t *testing.T) { func TestApexName(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -3816,7 +3816,7 @@ func TestApexName(t *testing.T) {
} }
func TestNonTestApex(t *testing.T) { func TestNonTestApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -3869,7 +3869,7 @@ func TestNonTestApex(t *testing.T) {
} }
func TestTestApex(t *testing.T) { func TestTestApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_test { apex_test {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -3918,7 +3918,7 @@ func TestTestApex(t *testing.T) {
} }
func TestApexWithTarget(t *testing.T) { func TestApexWithTarget(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4009,7 +4009,7 @@ func TestApexWithTarget(t *testing.T) {
} }
func TestApexWithArch(t *testing.T) { func TestApexWithArch(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4068,7 +4068,7 @@ func TestApexWithArch(t *testing.T) {
} }
func TestApexWithShBinary(t *testing.T) { func TestApexWithShBinary(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4109,7 +4109,7 @@ func TestApexInVariousPartition(t *testing.T) {
} }
for _, tc := range testcases { for _, tc := range testcases {
t.Run(tc.propName+":"+tc.parition, func(t *testing.T) { t.Run(tc.propName+":"+tc.parition, func(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4142,7 +4142,7 @@ func TestApexInVariousPartition(t *testing.T) {
} }
func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) { func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4196,7 +4196,7 @@ func TestFileContexts_ProductSpecificApexes(t *testing.T) {
} }
`) `)
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4219,7 +4219,7 @@ func TestFileContexts_ProductSpecificApexes(t *testing.T) {
} }
func TestFileContexts_SetViaFileGroup(t *testing.T) { func TestFileContexts_SetViaFileGroup(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4247,7 +4247,7 @@ func TestFileContexts_SetViaFileGroup(t *testing.T) {
} }
func TestApexKeyFromOtherModule(t *testing.T) { func TestApexKeyFromOtherModule(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_key { apex_key {
name: "myapex.key", name: "myapex.key",
public_key: ":my.avbpubkey", public_key: ":my.avbpubkey",
@ -4280,7 +4280,7 @@ func TestApexKeyFromOtherModule(t *testing.T) {
} }
func TestPrebuilt(t *testing.T) { func TestPrebuilt(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
prebuilt_apex { prebuilt_apex {
name: "myapex", name: "myapex",
arch: { arch: {
@ -4303,7 +4303,7 @@ func TestPrebuilt(t *testing.T) {
} }
func TestPrebuiltFilenameOverride(t *testing.T) { func TestPrebuiltFilenameOverride(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
prebuilt_apex { prebuilt_apex {
name: "myapex", name: "myapex",
src: "myapex-arm.apex", src: "myapex-arm.apex",
@ -4320,7 +4320,7 @@ func TestPrebuiltFilenameOverride(t *testing.T) {
} }
func TestPrebuiltOverrides(t *testing.T) { func TestPrebuiltOverrides(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
prebuilt_apex { prebuilt_apex {
name: "myapex.prebuilt", name: "myapex.prebuilt",
src: "myapex-arm.apex", src: "myapex-arm.apex",
@ -4831,7 +4831,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
} }
func TestApexWithTests(t *testing.T) { func TestApexWithTests(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_test { apex_test {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4943,7 +4943,7 @@ func TestApexWithTests(t *testing.T) {
} }
func TestInstallExtraFlattenedApexes(t *testing.T) { func TestInstallExtraFlattenedApexes(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5013,7 +5013,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
} }
func TestApexWithJavaImport(t *testing.T) { func TestApexWithJavaImport(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5042,7 +5042,7 @@ func TestApexWithJavaImport(t *testing.T) {
} }
func TestApexWithApps(t *testing.T) { func TestApexWithApps(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5121,7 +5121,7 @@ func TestApexWithApps(t *testing.T) {
} }
func TestApexWithAppImports(t *testing.T) { func TestApexWithAppImports(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5170,7 +5170,7 @@ func TestApexWithAppImports(t *testing.T) {
} }
func TestApexWithAppImportsPrefer(t *testing.T) { func TestApexWithAppImportsPrefer(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5213,7 +5213,7 @@ func TestApexWithAppImportsPrefer(t *testing.T) {
} }
func TestApexWithTestHelperApp(t *testing.T) { func TestApexWithTestHelperApp(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5424,7 +5424,7 @@ func TestApexAvailable_InvalidApexName(t *testing.T) {
} }
func TestApexAvailable_CheckForPlatform(t *testing.T) { func TestApexAvailable_CheckForPlatform(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5487,7 +5487,7 @@ func TestApexAvailable_CheckForPlatform(t *testing.T) {
} }
func TestApexAvailable_CreatedForApex(t *testing.T) { func TestApexAvailable_CreatedForApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5522,7 +5522,7 @@ func TestApexAvailable_CreatedForApex(t *testing.T) {
} }
func TestOverrideApex(t *testing.T) { func TestOverrideApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5606,7 +5606,7 @@ func TestOverrideApex(t *testing.T) {
} }
func TestLegacyAndroid10Support(t *testing.T) { func TestLegacyAndroid10Support(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5666,7 +5666,7 @@ var filesForSdkLibrary = map[string][]byte{
} }
func TestJavaSDKLibrary(t *testing.T) { func TestJavaSDKLibrary(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5704,7 +5704,7 @@ func TestJavaSDKLibrary(t *testing.T) {
} }
func TestJavaSDKLibrary_WithinApex(t *testing.T) { func TestJavaSDKLibrary_WithinApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5757,7 +5757,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) {
} }
func TestJavaSDKLibrary_CrossBoundary(t *testing.T) { func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5808,7 +5808,7 @@ func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
} }
func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
prebuilt_apis { prebuilt_apis {
name: "sdk", name: "sdk",
api_dirs: ["100"], api_dirs: ["100"],
@ -5925,7 +5925,7 @@ func TestJavaSDKLibrary_ImportOnly(t *testing.T) {
} }
func TestCompatConfig(t *testing.T) { func TestCompatConfig(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5986,7 +5986,7 @@ func TestRejectNonInstallableJavaLibrary(t *testing.T) {
} }
func TestCarryRequiredModuleNames(t *testing.T) { func TestCarryRequiredModuleNames(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6130,7 +6130,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
// For unbundled build, symlink shouldn't exist regardless of whether an APEX // For unbundled build, symlink shouldn't exist regardless of whether an APEX
// is updatable or not // is updatable or not
ctx, _ := testApex(t, bp, withUnbundledBuild) ctx := testApex(t, bp, withUnbundledBuild)
files := getFiles(t, ctx, "myapex", "android_common_myapex_image") files := getFiles(t, ctx, "myapex", "android_common_myapex_image")
ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "javalib/myjar.jar")
ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/mylib.so")
@ -6142,7 +6142,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
ensureRealfileExists(t, files, "lib64/myotherlib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so")
// For bundled build, symlink to the system for the non-updatable APEXes only // For bundled build, symlink to the system for the non-updatable APEXes only
ctx, _ = testApex(t, bp) ctx = testApex(t, bp)
files = getFiles(t, ctx, "myapex", "android_common_myapex_image") files = getFiles(t, ctx, "myapex", "android_common_myapex_image")
ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "javalib/myjar.jar")
ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/mylib.so")
@ -6155,7 +6155,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
} }
func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) { func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6207,7 +6207,7 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
} }
func TestApexWithJniLibs(t *testing.T) { func TestApexWithJniLibs(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6249,7 +6249,7 @@ func TestApexWithJniLibs(t *testing.T) {
} }
func TestApexMutatorsDontRunIfDisabled(t *testing.T) { func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6271,7 +6271,7 @@ func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
} }
func TestAppBundle(t *testing.T) { func TestAppBundle(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6302,7 +6302,7 @@ func TestAppBundle(t *testing.T) {
} }
func TestAppSetBundle(t *testing.T) { func TestAppSetBundle(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6335,7 +6335,7 @@ func TestAppSetBundle(t *testing.T) {
} }
func TestAppSetBundlePrebuilt(t *testing.T) { func TestAppSetBundlePrebuilt(t *testing.T) {
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) { ctx := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := ` bp := `
apex_set { apex_set {
name: "myapex", name: "myapex",
@ -6820,7 +6820,7 @@ func TestApexPermittedPackagesRules(t *testing.T) {
} }
func TestTestFor(t *testing.T) { func TestTestFor(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6906,7 +6906,7 @@ func intPtr(i int) *int {
} }
func TestApexSet(t *testing.T) { func TestApexSet(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_set { apex_set {
name: "myapex", name: "myapex",
set: "myapex.apks", set: "myapex.apks",
@ -6982,7 +6982,7 @@ func TestNoStaticLinkingToStubsLib(t *testing.T) {
} }
func TestApexKeysTxt(t *testing.T) { func TestApexKeysTxt(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7023,7 +7023,7 @@ func TestApexKeysTxt(t *testing.T) {
} }
func TestAllowedFiles(t *testing.T) { func TestAllowedFiles(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7079,7 +7079,7 @@ func TestAllowedFiles(t *testing.T) {
} }
func TestNonPreferredPrebuiltDependency(t *testing.T) { func TestNonPreferredPrebuiltDependency(t *testing.T) {
_, _ = testApex(t, ` testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7115,7 +7115,7 @@ func TestNonPreferredPrebuiltDependency(t *testing.T) {
} }
func TestCompressedApex(t *testing.T) { func TestCompressedApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7150,7 +7150,7 @@ func TestCompressedApex(t *testing.T) {
} }
func TestPreferredPrebuiltSharedLibDep(t *testing.T) { func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7202,7 +7202,7 @@ func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
} }
func TestExcludeDependency(t *testing.T) { func TestExcludeDependency(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7346,7 +7346,7 @@ func TestPrebuiltStubLibDep(t *testing.T) {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
for _, otherApexEnabled := range test.otherApexEnabled { for _, otherApexEnabled := range test.otherApexEnabled {
t.Run("otherapex_enabled_"+otherApexEnabled, func(t *testing.T) { t.Run("otherapex_enabled_"+otherApexEnabled, func(t *testing.T) {
ctx, _ := testApex(t, fmt.Sprintf(bpBase, otherApexEnabled)+test.stublibBp) ctx := testApex(t, fmt.Sprintf(bpBase, otherApexEnabled)+test.stublibBp)
type modAndMkEntries struct { type modAndMkEntries struct {
mod *cc.Module mod *cc.Module

View File

@ -28,7 +28,7 @@ import (
// modules from the ART apex. // modules from the ART apex.
func TestBootImages(t *testing.T) { func TestBootImages(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
java_sdk_library { java_sdk_library {
name: "foo", name: "foo",
srcs: ["b.java"], srcs: ["b.java"],
@ -181,7 +181,7 @@ func withFrameworkBootImageJars(bootJars ...string) func(fs map[string][]byte, c
} }
func TestBootImageInApex(t *testing.T) { func TestBootImageInApex(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",

View File

@ -9,7 +9,7 @@ import (
) )
func TestVndkApexForVndkLite(t *testing.T) { func TestVndkApexForVndkLite(t *testing.T) {
ctx, _ := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.current",
key: "com.android.vndk.current.key", key: "com.android.vndk.current.key",
@ -100,7 +100,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
} }
t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) { t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) {
ctx, _ := testApex(t, bp) ctx := testApex(t, bp)
// libfoo doesn't have apex variants // libfoo doesn't have apex variants
for _, variant := range ctx.ModuleVariantsForTests("libfoo") { for _, variant := range ctx.ModuleVariantsForTests("libfoo") {
@ -113,7 +113,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
}) })
t.Run("VNDK APEX gathers only vendor variants even if product variants are available", func(t *testing.T) { t.Run("VNDK APEX gathers only vendor variants even if product variants are available", func(t *testing.T) {
ctx, _ := testApex(t, bp, func(fs map[string][]byte, config android.Config) { ctx := testApex(t, bp, func(fs map[string][]byte, config android.Config) {
// Now product variant is available // Now product variant is available
config.TestProductVariables.ProductVndkVersion = proptools.StringPtr("current") config.TestProductVariables.ProductVndkVersion = proptools.StringPtr("current")
}) })
@ -123,7 +123,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
}) })
t.Run("VNDK APEX supports coverage variants", func(t *testing.T) { t.Run("VNDK APEX supports coverage variants", func(t *testing.T) {
ctx, _ := testApex(t, bp, func(fs map[string][]byte, config android.Config) { ctx := testApex(t, bp, func(fs map[string][]byte, config android.Config) {
config.TestProductVariables.GcovCoverage = proptools.BoolPtr(true) config.TestProductVariables.GcovCoverage = proptools.BoolPtr(true)
config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) config.TestProductVariables.Native_coverage = proptools.BoolPtr(true)
}) })