Make apex tests parallel
Mark all the apex tests and subtests with t.Parallel(), which will allow
the test runner to run them in parallel. Reduces the time required to
run the apex tests from 70s to 9.7s.
Test: go test ./apex
Flag: EXEMPT test only
Change-Id: I08bd3cb4d8eec1f9520c1118b4525aa79e95288e
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 68978b2..6f0357a 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -308,6 +308,7 @@
// Minimal test
func TestBasicApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_defaults {
name: "myapex-defaults",
@@ -605,6 +606,7 @@
}
func TestDefaults(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_defaults {
name: "myapex-defaults",
@@ -687,6 +689,7 @@
}
func TestApexManifest(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -709,6 +712,7 @@
}
func TestApexManifestMinSdkVersion(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_defaults {
name: "my_defaults",
@@ -782,6 +786,7 @@
}
func TestApexWithDessertSha(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_defaults {
name: "my_defaults",
@@ -855,6 +860,7 @@
}
func TestFileContexts(t *testing.T) {
+ t.Parallel()
for _, vendor := range []bool{true, false} {
prop := ""
if vendor {
@@ -889,6 +895,7 @@
}
func TestApexWithStubs(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -1060,6 +1067,7 @@
}
func TestApexShouldNotEmbedStubVariant(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex" .*: native_shared_libs: "libbar" is a stub`, `
apex {
name: "myapex",
@@ -1086,6 +1094,7 @@
}
func TestApexCanUsePrivateApis(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -1336,6 +1345,7 @@
}
func TestApexWithExplicitStubsDependency(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex2",
@@ -1422,6 +1432,7 @@
}
func TestApexWithRuntimeLibsDependency(t *testing.T) {
+ t.Parallel()
/*
myapex
|
@@ -1550,6 +1561,7 @@
)
func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(prepareForTestOfRuntimeApexWithHwasan).RunTestWithBp(t, `
cc_library {
name: "libc",
@@ -1603,6 +1615,7 @@
}
func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForTestOfRuntimeApexWithHwasan,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
@@ -1658,6 +1671,7 @@
}
func TestApexDependsOnLLNDKTransitively(t *testing.T) {
+ t.Parallel()
testcases := []struct {
name string
minSdkVersion string
@@ -1682,6 +1696,7 @@
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -1749,6 +1764,7 @@
}
func TestApexWithSystemLibsStubs(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -1841,6 +1857,7 @@
}
func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T) {
+ t.Parallel()
// there are three links between liba --> libz.
// 1) myapex -> libx -> liba -> libz : this should be #30 link
// 2) otherapex -> liby -> liba -> libz : this should be #30 link
@@ -1929,6 +1946,7 @@
}
func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -1981,6 +1999,7 @@
}
func TestApexMinSdkVersion_SupportsCodeNames_JavaLibs(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex {
name: "myapex",
@@ -2011,6 +2030,7 @@
}
func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2058,6 +2078,7 @@
}
func TestApexMinSdkVersion_InVendorApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2111,6 +2132,7 @@
}
func TestTrackAllowedDeps(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2178,6 +2200,7 @@
}
func TestTrackCustomAllowedDepsInvalidDefaultTxt(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2250,6 +2273,7 @@
}
func TestTrackCustomAllowedDepsWithDefaultTxt(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2323,6 +2347,7 @@
}
func TestTrackAllowedDeps_SkipWithoutAllowedDepsTxt(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2344,6 +2369,7 @@
}
func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2399,6 +2425,7 @@
)
func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2438,6 +2465,7 @@
}
func TestQTargetApexUsesStaticUnwinder(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2468,6 +2496,7 @@
}
func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "mylib".*: should support min_sdk_version\(29\)`, `
apex {
name: "myapex",
@@ -2573,6 +2602,7 @@
}
func TestApexMinSdkVersion_Okay(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex {
name: "myapex",
@@ -2633,6 +2663,7 @@
}
func TestApexMinSdkVersion_MinApiForArch(t *testing.T) {
+ t.Parallel()
// Tests that an apex dependency with min_sdk_version higher than the
// min_sdk_version of the apex is allowed as long as the dependency's
// min_sdk_version is less than or equal to the api level that the
@@ -2665,6 +2696,7 @@
}
func TestJavaStableSdkVersion(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
expectedError string
@@ -2804,6 +2836,7 @@
continue
}
t.Run(test.name, func(t *testing.T) {
+ t.Parallel()
errorHandler := android.FixtureExpectsNoErrors
if test.expectedError != "" {
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(test.expectedError)
@@ -2862,6 +2895,7 @@
}
func TestApexMinSdkVersion_ErrorIfDepIsNewer_Java(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "bar".*: should support min_sdk_version\(29\) for "myapex"`, `
apex {
name: "myapex",
@@ -2898,6 +2932,7 @@
}
func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -2951,6 +2986,7 @@
}
func TestApexMinSdkVersion_WorksWithSdkCodename(t *testing.T) {
+ t.Parallel()
withSAsActiveCodeNames := android.FixtureModifyProductVariables(
func(variables android.FixtureProductVariables) {
variables.Platform_sdk_codename = proptools.StringPtr("S")
@@ -2983,6 +3019,7 @@
}
func TestApexMinSdkVersion_WorksWithActiveCodenames(t *testing.T) {
+ t.Parallel()
withSAsActiveCodeNames := android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Platform_sdk_codename = proptools.StringPtr("S")
variables.Platform_version_active_codenames = []string{"S", "T"}
@@ -3021,6 +3058,7 @@
}
func TestFilesInSubDir(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3090,6 +3128,7 @@
}
func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3148,6 +3187,7 @@
}
func TestVendorApex(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForApexTest,
android.FixtureModifyConfig(android.SetKatiEnabledForTests),
@@ -3198,6 +3238,7 @@
}
func TestProductVariant(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3230,6 +3271,7 @@
}
func TestApex_withPrebuiltFirmware(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
additionalProp string
@@ -3239,6 +3281,7 @@
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3267,6 +3310,7 @@
}
func TestAndroidMk_VendorApexRequired(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3329,6 +3373,7 @@
}
func TestStaticLinking(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3371,6 +3416,7 @@
}
func TestKeys(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex_keytest",
@@ -3428,7 +3474,9 @@
}
func TestCertificate(t *testing.T) {
+ t.Parallel()
t.Run("if unspecified, it defaults to DefaultAppCertificate", func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3447,6 +3495,7 @@
}
})
t.Run("override when unspecified", func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex_keytest",
@@ -3470,6 +3519,7 @@
}
})
t.Run("if specified as :module, it respects the prop", func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3493,6 +3543,7 @@
}
})
t.Run("override when specifiec as <:module>", func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex_keytest",
@@ -3517,6 +3568,7 @@
}
})
t.Run("if specified as name, finds it from DefaultDevKeyDir", func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3536,6 +3588,7 @@
}
})
t.Run("override when specified as <name>", func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex_keytest",
@@ -3562,6 +3615,7 @@
}
func TestMacro(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3655,6 +3709,7 @@
}
func TestHeaderLibsDependency(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -3858,6 +3913,7 @@
}
func TestVndkApexVersion(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.v27",
@@ -3927,6 +3983,7 @@
}
func TestVndkApexNameRule(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.v29",
@@ -3959,6 +4016,7 @@
}
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "com.android.vndk.v30" .*: native_bridge_supported: .* doesn't support native bridge binary`, `
apex_vndk {
name: "com.android.vndk.v30",
@@ -3989,6 +4047,7 @@
}
func TestVndkApexWithBinder32(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.v27",
@@ -4067,6 +4126,7 @@
}
func TestDependenciesInApexManifest(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex_nodep",
@@ -4200,6 +4260,7 @@
}
func TestOverrideApexManifestDefaultVersion(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4234,6 +4295,7 @@
}
func TestCompileMultilibProp(t *testing.T) {
+ t.Parallel()
testCases := []struct {
compileMultiLibProp string
containedLibs []string
@@ -4304,6 +4366,7 @@
}
func TestNonTestApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4357,6 +4420,7 @@
}
func TestTestApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_test {
name: "myapex",
@@ -4406,6 +4470,7 @@
}
func TestLibzVendorIsntStable(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4472,6 +4537,7 @@
}
func TestApexWithTarget(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4563,6 +4629,7 @@
}
func TestApexWithArch(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4638,6 +4705,7 @@
}
func TestApexWithShBinary(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4668,6 +4736,7 @@
}
func TestApexInVariousPartition(t *testing.T) {
+ t.Parallel()
testcases := []struct {
propName, partition string
}{
@@ -4680,6 +4749,7 @@
}
for _, tc := range testcases {
t.Run(tc.propName+":"+tc.partition, func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4706,6 +4776,7 @@
}
func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4725,6 +4796,7 @@
}
func TestFileContexts_ShouldBeUnderSystemSepolicyForSystemApexes(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: file_contexts: should be under system/sepolicy`, `
apex {
name: "myapex",
@@ -4744,6 +4816,7 @@
}
func TestFileContexts_ProductSpecificApexes(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: file_contexts: cannot find`, `
apex {
name: "myapex",
@@ -4783,6 +4856,7 @@
}
func TestFileContexts_SetViaFileGroup(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -4811,6 +4885,7 @@
}
func TestApexKeyFromOtherModule(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_key {
name: "myapex.key",
@@ -4844,6 +4919,7 @@
}
func TestPrebuilt(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
prebuilt_apex {
name: "myapex",
@@ -4878,6 +4954,7 @@
}
func TestPrebuiltMissingSrc(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex" variant "android_common_myapex".*: prebuilt_apex does not support "arm64_armv8-a"`, `
prebuilt_apex {
name: "myapex",
@@ -4886,6 +4963,7 @@
}
func TestPrebuiltFilenameOverride(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
prebuilt_apex {
name: "myapex",
@@ -4909,6 +4987,7 @@
}
func TestApexSetFilenameOverride(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex_set {
name: "com.company.android.myapex",
@@ -4938,6 +5017,7 @@
}
func TestPrebuiltOverrides(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
prebuilt_apex {
name: "myapex.prebuilt",
@@ -4964,6 +5044,7 @@
}
func TestPrebuiltApexName(t *testing.T) {
+ t.Parallel()
testApex(t, `
prebuilt_apex {
name: "com.company.android.myapex",
@@ -4982,6 +5063,7 @@
}
func TestPrebuiltApexNameWithPlatformBootclasspath(t *testing.T) {
+ t.Parallel()
_ = android.GroupFixturePreparers(
java.PrepareForTestWithJavaDefaultModules,
PrepareForTestWithApexBuildComponents,
@@ -5032,6 +5114,7 @@
}
func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
+ t.Parallel()
preparer := android.GroupFixturePreparers(
java.FixtureConfigureApexBootJars("myapex:libfoo", "myapex:libbar"),
// Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding
@@ -5077,6 +5160,7 @@
}
t.Run("prebuilt only", func(t *testing.T) {
+ t.Parallel()
bp := `
prebuilt_apex {
name: "myapex",
@@ -5138,6 +5222,7 @@
})
t.Run("apex_set only", func(t *testing.T) {
+ t.Parallel()
bp := `
apex_set {
name: "myapex",
@@ -5228,6 +5313,7 @@
})
t.Run("prebuilt with source library preferred", func(t *testing.T) {
+ t.Parallel()
bp := `
prebuilt_apex {
name: "myapex",
@@ -5301,6 +5387,7 @@
})
t.Run("prebuilt library preferred with source", func(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -5403,6 +5490,7 @@
})
t.Run("prebuilt with source apex preferred", func(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -5501,6 +5589,7 @@
})
t.Run("prebuilt preferred with source apex disabled", func(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -5612,6 +5701,7 @@
})
t.Run("Co-existing unflagged apexes should create a duplicate module error", func(t *testing.T) {
+ t.Parallel()
bp := `
// Source
apex {
@@ -5691,6 +5781,7 @@
}
func TestApexWithTests(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_test {
name: "myapex",
@@ -5766,6 +5857,7 @@
}
func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex" .* depends on disabled module "libfoo"`, `
apex {
name: "myapex",
@@ -5841,6 +5933,7 @@
}
func TestApexWithApps(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -5935,6 +6028,7 @@
}
func TestApexWithAppImportBuildId(t *testing.T) {
+ t.Parallel()
invalidBuildIds := []string{"../", "a b", "a/b", "a/b/../c", "/a"}
for _, id := range invalidBuildIds {
message := fmt.Sprintf("Unable to use build id %s as filename suffix", id)
@@ -5965,6 +6059,7 @@
}
func TestApexWithAppImports(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -6014,6 +6109,7 @@
}
func TestApexWithAppImportsPrefer(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -6056,6 +6152,7 @@
}
func TestApexWithTestHelperApp(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -6089,6 +6186,7 @@
}
func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
+ t.Parallel()
// libfoo's apex_available comes from cc_defaults
testApexError(t, `requires "libfoo" that doesn't list the APEX under 'apex_available'.`, `
apex {
@@ -6125,6 +6223,7 @@
}
func TestApexAvailable_DirectDep(t *testing.T) {
+ t.Parallel()
// libfoo is not available to myapex, but only to otherapex
testApexError(t, "requires \"libfoo\" that doesn't list the APEX under 'apex_available'.", `
apex {
@@ -6243,6 +6342,7 @@
}
func TestApexAvailable_IndirectDep(t *testing.T) {
+ t.Parallel()
// libbbaz is an indirect dep
testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'.\n\nDependency path:
.*via tag apex\.dependencyTag\{"sharedLib"\}
@@ -6373,6 +6473,7 @@
}
func TestApexAvailable_IndirectStaticDep(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex {
name: "myapex",
@@ -6439,6 +6540,7 @@
}
func TestApexAvailable_InvalidApexName(t *testing.T) {
+ t.Parallel()
testApexError(t, "\"otherapex\" is not a valid module name", `
apex {
name: "myapex",
@@ -6500,7 +6602,9 @@
}
func TestApexAvailable_ApexAvailableNameWithVersionCodeError(t *testing.T) {
+ t.Parallel()
t.Run("negative variant_version produces error", func(t *testing.T) {
+ t.Parallel()
testApexError(t, "expected an integer between 0-9; got -1", `
apex {
name: "myapex",
@@ -6518,6 +6622,7 @@
})
t.Run("variant_version greater than 9 produces error", func(t *testing.T) {
+ t.Parallel()
testApexError(t, "expected an integer between 0-9; got 10", `
apex {
name: "myapex",
@@ -6536,6 +6641,7 @@
}
func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) {
+ t.Parallel()
context := android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
PrepareForTestWithApexBuildComponents,
@@ -6593,7 +6699,9 @@
}
func TestApexAvailable_ApexAvailableName(t *testing.T) {
+ t.Parallel()
t.Run("using name of apex that sets apex_available_name is not allowed", func(t *testing.T) {
+ t.Parallel()
testApexError(t, "Consider adding \"myapex\" to 'apex_available' property of \"AppFoo\"", `
apex {
name: "myapex_sminus",
@@ -6627,6 +6735,7 @@
})
t.Run("apex_available_name allows module to be used in two different apexes", func(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex {
name: "myapex_sminus",
@@ -6660,6 +6769,7 @@
})
t.Run("override_apexes work with apex_available_name", func(t *testing.T) {
+ t.Parallel()
testApex(t, `
override_apex {
name: "myoverrideapex_sminus",
@@ -6713,6 +6823,7 @@
}
func TestApexAvailable_ApexAvailableNameWithOverrides(t *testing.T) {
+ t.Parallel()
context := android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
PrepareForTestWithApexBuildComponents,
@@ -6770,6 +6881,7 @@
}
func TestApexAvailable_CheckForPlatform(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -6833,6 +6945,7 @@
}
func TestApexAvailable_CreatedForApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -6868,6 +6981,7 @@
}
func TestApexAvailable_PrefixMatch(t *testing.T) {
+ t.Parallel()
for _, tc := range []struct {
name string
@@ -6905,6 +7019,7 @@
},
} {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
errorHandler := android.FixtureExpectsNoErrors
if tc.expectedError != "" {
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(tc.expectedError)
@@ -6961,6 +7076,7 @@
}
func TestOverrideApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7111,6 +7227,7 @@
}
func TestMinSdkVersionOverride(t *testing.T) {
+ t.Parallel()
// Override from 29 to 31
minSdkOverride31 := "31"
ctx := testApex(t, `
@@ -7170,6 +7287,7 @@
}
func TestMinSdkVersionOverrideToLowerVersionNoOp(t *testing.T) {
+ t.Parallel()
// Attempt to override from 31 to 29, should be a NOOP
minSdkOverride29 := "29"
ctx := testApex(t, `
@@ -7229,6 +7347,7 @@
}
func TestLegacyAndroid10Support(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7289,6 +7408,7 @@
}
func TestJavaSDKLibrary(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7328,6 +7448,7 @@
}
func TestJavaSDKLibraryOverrideApexes(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
override_apex {
name: "mycompanyapex",
@@ -7368,6 +7489,7 @@
}
func TestJavaSDKLibrary_WithinApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7421,6 +7543,7 @@
}
func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7472,6 +7595,7 @@
}
func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
prebuilt_apis {
name: "sdk",
@@ -7562,6 +7686,7 @@
}
func TestJavaSDKLibrary_ImportOnly(t *testing.T) {
+ t.Parallel()
testApexError(t, `java_libs: "foo" is not configured to be compiled into dex`, `
apex {
name: "myapex",
@@ -7589,6 +7714,7 @@
}
func TestCompatConfig(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForApexTest,
java.PrepareForTestWithPlatformCompatConfig,
@@ -7635,6 +7761,7 @@
}
func TestNoDupeApexFiles(t *testing.T) {
+ t.Parallel()
android.GroupFixturePreparers(
android.PrepareForTestWithAndroidBuildComponents,
PrepareForTestWithApexBuildComponents,
@@ -7671,6 +7798,7 @@
}
func TestApexUnwantedTransitiveDeps(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -7707,6 +7835,7 @@
}
func TestRejectNonInstallableJavaLibrary(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myjar" is not configured to be compiled into dex`, `
apex {
name: "myapex",
@@ -7733,6 +7862,7 @@
}
func TestCarryRequiredModuleNames(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7772,6 +7902,7 @@
}
func TestSymlinksFromApexToSystem(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -7926,6 +8057,7 @@
}
func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -7978,6 +8110,7 @@
}
func TestApexWithJniLibs(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8067,6 +8200,7 @@
}
func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8091,6 +8225,7 @@
}
func TestAppBundle(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8122,6 +8257,7 @@
}
func TestAppSetBundle(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8189,6 +8325,7 @@
}
func TestApexSetApksModuleAssignment(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_set {
name: "myapex",
@@ -8267,6 +8404,7 @@
}
func TestUpdatable_should_set_min_sdk_version(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: updatable: updatable APEXes should set min_sdk_version`, `
apex {
name: "myapex",
@@ -8283,6 +8421,7 @@
}
func TestUpdatableDefault_should_set_min_sdk_version(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: updatable: updatable APEXes should set min_sdk_version`, `
apex {
name: "myapex",
@@ -8298,6 +8437,7 @@
}
func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
+ t.Parallel()
testApexError(t, `"mysystemserverclasspathfragment" .* it must not set generate_classpaths_proto to false`, `
apex {
name: "myapex",
@@ -8342,8 +8482,10 @@
}
func TestDexpreoptAccessDexFilesFromPrebuiltApex(t *testing.T) {
+ t.Parallel()
preparer := java.FixtureConfigureApexBootJars("myapex:libfoo")
t.Run("prebuilt no source", func(t *testing.T) {
+ t.Parallel()
fragment := java.ApexVariantReference{
Apex: proptools.StringPtr("myapex"),
Module: proptools.StringPtr("my-bootclasspath-fragment"),
@@ -8429,6 +8571,7 @@
}
func TestApexPermittedPackagesRules(t *testing.T) {
+ t.Parallel()
testcases := []struct {
name string
expectedError string
@@ -8548,6 +8691,7 @@
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
rules := createBcpPermittedPackagesRules(tc.bcpPermittedPackages)
testBootJarPermittedPackagesRules(t, tc.expectedError, tc.bp, tc.bootJars, rules)
})
@@ -8555,6 +8699,7 @@
}
func TestTestFor(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8632,6 +8777,7 @@
}
func TestIndirectTestFor(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8692,6 +8838,7 @@
}
func TestTestForForLibInOtherApex(t *testing.T) {
+ t.Parallel()
// This case is only allowed for known overlapping APEXes, i.e. the ART APEXes.
_ = testApex(t, `
apex {
@@ -8747,6 +8894,7 @@
}
func TestApexSet(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_set {
name: "myapex",
@@ -8791,6 +8939,7 @@
}
func TestApexSet_NativeBridge(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_set {
name: "myapex",
@@ -8815,6 +8964,7 @@
}
func TestNoStaticLinkingToStubsLib(t *testing.T) {
+ t.Parallel()
testApexError(t, `.*required by "mylib" is a native library providing stub.*`, `
apex {
name: "myapex",
@@ -8852,6 +9002,7 @@
}
func TestApexKeysTxt(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8873,6 +9024,7 @@
}
func TestApexKeysTxtOverrides(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8917,6 +9069,7 @@
}
func TestAllowedFiles(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -8973,6 +9126,7 @@
}
func TestNonPreferredPrebuiltDependency(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex {
name: "myapex",
@@ -9009,6 +9163,7 @@
}
func TestCompressedApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9046,8 +9201,10 @@
}
func TestApexSet_ShouldRespectCompressedApexFlag(t *testing.T) {
+ t.Parallel()
for _, compressionEnabled := range []bool{true, false} {
t.Run(fmt.Sprintf("compressionEnabled=%v", compressionEnabled), func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex_set {
name: "com.company.android.myapex",
@@ -9070,6 +9227,7 @@
}
func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9122,6 +9280,7 @@
}
func TestExcludeDependency(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9172,6 +9331,7 @@
}
func TestPrebuiltStubLibDep(t *testing.T) {
+ t.Parallel()
bpBase := `
apex {
name: "myapex",
@@ -9264,8 +9424,10 @@
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
+ t.Parallel()
for _, otherApexEnabled := range test.otherApexEnabled {
t.Run("otherapex_enabled_"+otherApexEnabled, func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, fmt.Sprintf(bpBase, otherApexEnabled)+test.stublibBp)
type modAndMkEntries struct {
@@ -9333,6 +9495,7 @@
}
func TestApexJavaCoverage(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -9411,6 +9574,7 @@
}
func TestProhibitStaticExecutable(t *testing.T) {
+ t.Parallel()
testApexError(t, `executable mybin is static`, `
apex {
name: "myapex",
@@ -9462,6 +9626,7 @@
}
func TestAndroidMk_DexpreoptBuiltInstalledForApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9495,6 +9660,7 @@
}
func TestAndroidMk_RequiredModules(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9534,6 +9700,7 @@
}
func TestAndroidMk_RequiredDeps(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9558,6 +9725,7 @@
}
func TestApexOutputFileProducer(t *testing.T) {
+ t.Parallel()
for _, tc := range []struct {
name string
ref string
@@ -9575,6 +9743,7 @@
},
} {
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -9606,6 +9775,7 @@
}
func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
+ t.Parallel()
preparer := android.GroupFixturePreparers(
PrepareForTestWithApexBuildComponents,
prepareForTestWithMyapex,
@@ -9618,6 +9788,7 @@
// Test java_sdk_library in bootclasspath_fragment may define higher min_sdk_version than the apex
t.Run("bootclasspath_fragment jar has higher min_sdk_version than apex", func(t *testing.T) {
+ t.Parallel()
preparer.RunTestWithBp(t, `
apex {
name: "myapex",
@@ -9674,6 +9845,7 @@
// Test java_sdk_library in systemserverclasspath_fragment may define higher min_sdk_version than the apex
t.Run("systemserverclasspath_fragment jar has higher min_sdk_version than apex", func(t *testing.T) {
+ t.Parallel()
preparer.RunTestWithBp(t, `
apex {
name: "myapex",
@@ -9723,6 +9895,7 @@
})
t.Run("bootclasspath_fragment jar must set min_sdk_version", func(t *testing.T) {
+ t.Parallel()
preparer.
RunTestWithBp(t, `
apex {
@@ -9761,6 +9934,7 @@
})
t.Run("systemserverclasspath_fragment jar must set min_sdk_version", func(t *testing.T) {
+ t.Parallel()
preparer.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "mysystemserverclasspathlib".*must set min_sdk_version`)).
RunTestWithBp(t, `
apex {
@@ -9811,6 +9985,7 @@
}
func TestApexStrictUpdtabilityLint(t *testing.T) {
+ t.Parallel()
bpTemplate := `
apex {
name: "myapex",
@@ -9882,6 +10057,7 @@
for _, testCase := range testCases {
t.Run(testCase.testCaseName, func(t *testing.T) {
+ t.Parallel()
fixtures := []android.FixturePreparer{}
baselineProperty := ""
if testCase.lintFileExists {
@@ -9922,6 +10098,7 @@
// checks transtive deps of an apex coming from bootclasspath_fragment
func TestApexStrictUpdtabilityLintBcpFragmentDeps(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -9967,6 +10144,7 @@
}
func TestApexLintBcpFragmentSdkLibDeps(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -10018,6 +10196,7 @@
// updatable apexes should propagate updatable=true to its apps
func TestUpdatableApexEnforcesAppUpdatability(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -10047,6 +10226,7 @@
}
func TestTrimmedApex(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -10101,6 +10281,7 @@
}
func TestCannedFsConfig(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -10121,6 +10302,7 @@
}
func TestCannedFsConfig_HasCustomConfig(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -10143,6 +10325,7 @@
}
func TestStubLibrariesMultipleApexViolation(t *testing.T) {
+ t.Parallel()
testCases := []struct {
desc string
hasStubs bool
@@ -10217,6 +10400,7 @@
}
func TestFileSystemShouldSkipApexLibraries(t *testing.T) {
+ t.Parallel()
context := android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
cc.PrepareForIntegrationTestWithCc,
@@ -10286,6 +10470,7 @@
`
func TestAconfigFilesJavaDeps(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, apex_default_bp+`
apex {
name: "myapex",
@@ -10377,6 +10562,7 @@
}
func TestAconfigFilesJavaAndCcDeps(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, apex_default_bp+`
apex {
name: "myapex",
@@ -10515,6 +10701,7 @@
}
func TestAconfigFilesRustDeps(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, apex_default_bp+`
apex {
name: "myapex",
@@ -10706,6 +10893,7 @@
}
func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, apex_default_bp+`
apex {
name: "myapex",
@@ -10790,6 +10978,7 @@
}
func TestAconfigFilesRemoveDuplicates(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, apex_default_bp+`
apex {
name: "myapex",
@@ -10869,6 +11058,7 @@
// Test that the boot jars come from the _selected_ apex prebuilt
// RELEASE_APEX_CONTIRBUTIONS_* build flags will be used to select the correct prebuilt for a specific release config
func TestBootDexJarsMultipleApexPrebuilts(t *testing.T) {
+ t.Parallel()
checkBootDexJarPath := func(t *testing.T, ctx *android.TestContext, stem string, bootDexJarPath string) {
t.Helper()
s := ctx.ModuleForTests("dex_bootjars", "android_common")
@@ -11057,6 +11247,7 @@
// Test that product packaging installs the selected mainline module (either source or a specific prebuilt)
// RELEASE_APEX_CONTIRBUTIONS_* build flags will be used to select the correct prebuilt for a specific release config
func TestInstallationRulesForMultipleApexPrebuilts(t *testing.T) {
+ t.Parallel()
// for a mainline module family, check that only the flagged soong module is visible to make
checkHideFromMake := func(t *testing.T, ctx *android.TestContext, visibleModuleName string, hiddenModuleNames []string) {
variation := func(moduleName string) string {
@@ -11202,6 +11393,7 @@
// Test that product packaging installs the selected mainline module in workspaces withtout source mainline module
func TestInstallationRulesForMultipleApexPrebuiltsWithoutSource(t *testing.T) {
+ t.Parallel()
// for a mainline module family, check that only the flagged soong module is visible to make
checkHideFromMake := func(t *testing.T, ctx *android.TestContext, visibleModuleNames []string, hiddenModuleNames []string) {
variation := func(moduleName string) string {
@@ -11309,6 +11501,7 @@
}
func TestAconfifDeclarationsValidation(t *testing.T) {
+ t.Parallel()
aconfigDeclarationLibraryString := func(moduleNames []string) (ret string) {
for _, moduleName := range moduleNames {
ret += fmt.Sprintf(`
@@ -11425,6 +11618,7 @@
}
func TestMultiplePrebuiltsWithSameBase(t *testing.T) {
+ t.Parallel()
ctx := testApex(t, `
apex {
name: "myapex",
@@ -11464,6 +11658,7 @@
}
func TestApexMinSdkVersionOverride(t *testing.T) {
+ t.Parallel()
checkMinSdkVersion := func(t *testing.T, module android.TestingModule, expectedMinSdkVersion string) {
args := module.Rule("apexRule").Args
optFlags := args["opt_flags"]
@@ -11540,6 +11735,7 @@
}
func TestOverrideApexWithPrebuiltApexPreferred(t *testing.T) {
+ t.Parallel()
context := android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
PrepareForTestWithApexBuildComponents,
@@ -11575,6 +11771,7 @@
}
func TestUpdatableApexMinSdkVersionCurrent(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: updatable: updatable APEXes should not set min_sdk_version to current. Please use a finalized API level or a recognized in-development codename`, `
apex {
name: "myapex",
@@ -11592,6 +11789,7 @@
}
func TestPrebuiltStubNoinstall(t *testing.T) {
+ t.Parallel()
testFunc := func(t *testing.T, expectLibfooOnSystemLib bool, fs android.MockFS) {
result := android.GroupFixturePreparers(
prepareForApexTest,
@@ -11671,6 +11869,7 @@
`)
t.Run("prebuilt stub (without source): no install", func(t *testing.T) {
+ t.Parallel()
testFunc(
t,
/*expectLibfooOnSystemLib=*/ false,
@@ -11695,6 +11894,7 @@
`)
t.Run("prebuilt stub (with disabled source): no install", func(t *testing.T) {
+ t.Parallel()
testFunc(
t,
/*expectLibfooOnSystemLib=*/ false,
@@ -11710,6 +11910,7 @@
}
func TestSdkLibraryTransitiveClassLoaderContext(t *testing.T) {
+ t.Parallel()
// This test case tests that listing the impl lib instead of the top level java_sdk_library
// in libs of android_app and java_library does not lead to class loader context device/host
// path mismatch errors.
@@ -11819,6 +12020,7 @@
// If an apex sets system_ext_specific: true, its systemserverclasspath libraries must set this property as well.
func TestApexSSCPJarMustBeInSamePartitionAsApex(t *testing.T) {
+ t.Parallel()
testApexError(t, `foo is an apex systemserver jar, but its partition does not match the partition of its containing apex`, `
apex {
name: "myapex",