Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.
Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
diff --git a/apex/apex_test.go b/apex/apex_test.go
index cf2c953..5a9a3b1 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -345,6 +345,7 @@
// Minimal test
func TestBasicApex(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex_defaults {
name: "myapex-defaults",
@@ -597,6 +598,7 @@
}
func TestDefaults(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_defaults {
name: "myapex-defaults",
@@ -671,6 +673,7 @@
}
func TestApexManifest(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -692,6 +695,7 @@
}
func TestBasicZipApex(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -742,6 +746,7 @@
}
func TestApexWithStubs(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -934,6 +939,7 @@
}
func TestApexWithExplicitStubsDependency(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex2",
@@ -1021,6 +1027,7 @@
}
func TestApexWithRuntimeLibsDependency(t *testing.T) {
+ t.Parallel()
/*
myapex
|
@@ -1090,6 +1097,7 @@
}
func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := `
apex {
@@ -1153,6 +1161,7 @@
}
func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := `
apex {
@@ -1214,6 +1223,7 @@
}
func TestApexDependsOnLLNDKTransitively(t *testing.T) {
+ t.Parallel()
testcases := []struct {
name string
minSdkVersion string
@@ -1303,6 +1313,7 @@
}
func TestApexWithSystemLibsStubs(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -1393,6 +1404,7 @@
}
func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T) {
+ t.Parallel()
// there are three links between liba --> libz
// 1) myapex -> libx -> liba -> libz : this should be #29 link, but fallback to #28
// 2) otherapex -> liby -> liba -> libz : this should be #30 link
@@ -1479,6 +1491,7 @@
}
func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -1528,6 +1541,7 @@
}
func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -1573,6 +1587,7 @@
}
func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -1620,6 +1635,7 @@
}
func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -1659,6 +1675,7 @@
}
func TestQTargetApexUsesStaticUnwinder(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -1689,6 +1706,7 @@
}
func TestApexMinSdkVersion_ErrorIfIncompatibleStubs(t *testing.T) {
+ t.Parallel()
testApexError(t, `"libz" .*: not found a version\(<=29\)`, `
apex {
name: "myapex",
@@ -1724,6 +1742,7 @@
}
func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "mylib".*: should support min_sdk_version\(29\)`, `
apex {
name: "myapex",
@@ -1752,6 +1771,7 @@
}
func TestApexMinSdkVersion_Okay(t *testing.T) {
+ t.Parallel()
testApex(t, `
apex {
name: "myapex",
@@ -1802,6 +1822,7 @@
}
func TestJavaStableSdkVersion(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
expectedError string
@@ -1919,6 +1940,7 @@
}
func TestApexMinSdkVersion_ErrorIfDepIsNewer(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "mylib2".*: should support min_sdk_version\(29\) for "myapex"`, `
apex {
name: "myapex",
@@ -1960,6 +1982,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",
@@ -1995,6 +2018,7 @@
}
func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2048,6 +2072,7 @@
}
func TestFilesInSubDir(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2110,6 +2135,7 @@
}
func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2168,6 +2194,7 @@
}
func TestUseVendor(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2222,6 +2249,7 @@
}
func TestUseVendorNotAllowedForSystemApexes(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex" .*: use_vendor: not allowed`, `
apex {
name: "myapex",
@@ -2254,6 +2282,7 @@
}
func TestUseVendorFailsIfNotVendorAvailable(t *testing.T) {
+ t.Parallel()
testApexError(t, `dependency "mylib" of "myapex" missing variant:\n.*image:vendor`, `
apex {
name: "myapex",
@@ -2278,6 +2307,7 @@
}
func TestVendorApex(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -2323,6 +2353,7 @@
}
func TestVendorApex_use_vndk_as_stable(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2376,6 +2407,7 @@
}
func TestApex_withPrebuiltFirmware(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
additionalProp string
@@ -2412,6 +2444,7 @@
}
func TestAndroidMk_UseVendorRequired(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -2446,6 +2479,7 @@
}
func TestAndroidMk_VendorApexRequired(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -2477,6 +2511,7 @@
}
func TestAndroidMkWritesCommonProperties(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -2506,6 +2541,7 @@
}
func TestStaticLinking(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2550,6 +2586,7 @@
}
func TestKeys(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex_keytest",
@@ -2606,6 +2643,7 @@
}
func TestCertificate(t *testing.T) {
+ t.Parallel()
t.Run("if unspecified, it defaults to DefaultAppCertificate", func(t *testing.T) {
ctx, _ := testApex(t, `
apex {
@@ -2734,6 +2772,7 @@
}
func TestMacro(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -2861,6 +2900,7 @@
}
func TestHeaderLibsDependency(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -3004,6 +3044,7 @@
}
func TestVndkApexCurrent(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@@ -3057,6 +3098,7 @@
}
func TestVndkApexWithPrebuilt(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@@ -3139,6 +3181,7 @@
}
func TestVndkApexVersion(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex_v27",
@@ -3205,6 +3248,7 @@
}
func TestVndkApexErrorWithDuplicateVersion(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex_v27.*" .*: vndk_version: 27 is already defined in "myapex_v27.*"`, `
apex_vndk {
name: "myapex_v27",
@@ -3251,6 +3295,7 @@
}
func TestVndkApexNameRule(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@@ -3282,6 +3327,7 @@
}
func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@@ -3320,6 +3366,7 @@
}
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex" .*: native_bridge_supported: .* doesn't support native bridge binary`, `
apex_vndk {
name: "myapex",
@@ -3350,6 +3397,7 @@
}
func TestVndkApexWithBinder32(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex_v27",
@@ -3416,6 +3464,7 @@
}
func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@@ -3450,6 +3499,7 @@
}
func TestDependenciesInApexManifest(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex_nodep",
@@ -3554,6 +3604,7 @@
}
func TestApexName(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -3598,6 +3649,7 @@
}
func TestNonTestApex(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -3650,6 +3702,7 @@
}
func TestTestApex(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_test {
name: "myapex",
@@ -3698,6 +3751,7 @@
}
func TestApexWithTarget(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -3788,6 +3842,7 @@
}
func TestApexWithShBinary(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -3816,6 +3871,7 @@
}
func TestApexInVariousPartition(t *testing.T) {
+ t.Parallel()
testcases := []struct {
propName, parition, flattenedPartition string
}{
@@ -3860,6 +3916,7 @@
}
func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -3878,6 +3935,7 @@
}
func TestFileContexts_ShouldBeUnderSystemSepolicyForSystemApexes(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: file_contexts: should be under system/sepolicy`, `
apex {
name: "myapex",
@@ -3896,6 +3954,7 @@
}
func TestFileContexts_ProductSpecificApexes(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myapex" .*: file_contexts: cannot find`, `
apex {
name: "myapex",
@@ -3933,6 +3992,7 @@
}
func TestFileContexts_SetViaFileGroup(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -3960,6 +4020,7 @@
}
func TestApexKeyFromOtherModule(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_key {
name: "myapex.key",
@@ -3993,6 +4054,7 @@
}
func TestPrebuilt(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
prebuilt_apex {
name: "myapex",
@@ -4016,6 +4078,7 @@
}
func TestPrebuiltFilenameOverride(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
prebuilt_apex {
name: "myapex",
@@ -4033,6 +4096,7 @@
}
func TestPrebuiltOverrides(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
prebuilt_apex {
name: "myapex.prebuilt",
@@ -4053,6 +4117,7 @@
}
func TestApexWithTests(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex_test {
name: "myapex",
@@ -4164,6 +4229,7 @@
}
func TestInstallExtraFlattenedApexes(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -4187,6 +4253,7 @@
}
func TestApexUsesOtherApex(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4247,6 +4314,7 @@
}
func TestApexUsesFailsIfNotProvided(t *testing.T) {
+ t.Parallel()
testApexError(t, `uses: "commonapex" does not provide native_shared_libs`, `
apex {
name: "myapex",
@@ -4287,6 +4355,7 @@
}
func TestApexUsesFailsIfUseVenderMismatch(t *testing.T) {
+ t.Parallel()
testApexError(t, `use_vendor: "commonapex" has different value of use_vendor`, `
apex {
name: "myapex",
@@ -4312,6 +4381,7 @@
}
func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
+ t.Parallel()
testApexError(t, `module "myapex" .* depends on disabled module "libfoo"`, `
apex {
name: "myapex",
@@ -4358,6 +4428,7 @@
}
func TestApexWithApps(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4436,6 +4507,7 @@
}
func TestApexWithAppImports(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4484,6 +4556,7 @@
}
func TestApexWithAppImportsPrefer(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4525,6 +4598,7 @@
}
func TestApexWithTestHelperApp(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4556,6 +4630,7 @@
}
func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
+ t.Parallel()
// libfoo's apex_available comes from cc_defaults
testApexError(t, `requires "libfoo" that is not available for the APEX`, `
apex {
@@ -4590,6 +4665,7 @@
}
func TestApexAvailable_DirectDep(t *testing.T) {
+ t.Parallel()
// libfoo is not available to myapex, but only to otherapex
testApexError(t, "requires \"libfoo\" that is not available for the APEX", `
apex {
@@ -4625,6 +4701,7 @@
}
func TestApexAvailable_IndirectDep(t *testing.T) {
+ t.Parallel()
// libbbaz is an indirect dep
testApexError(t, `requires "libbaz" that is not available for the APEX. Dependency path:
.*via tag apex\.dependencyTag.*name:sharedLib.*
@@ -4669,6 +4746,7 @@
}
func TestApexAvailable_InvalidApexName(t *testing.T) {
+ t.Parallel()
testApexError(t, "\"otherapex\" is not a valid module name", `
apex {
name: "myapex",
@@ -4728,6 +4806,7 @@
}
func TestApexAvailable_CheckForPlatform(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4790,6 +4869,7 @@
}
func TestApexAvailable_CreatedForApex(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4824,6 +4904,7 @@
}
func TestOverrideApex(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -4907,6 +4988,7 @@
}
func TestLegacyAndroid10Support(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4962,6 +5044,7 @@
}
func TestJavaSDKLibrary(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -4994,6 +5077,7 @@
}
func TestJavaSDKLibrary_WithinApex(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5041,6 +5125,7 @@
}
func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5086,6 +5171,7 @@
}
func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, ``,
withFiles(map[string][]byte{
"apex/a.java": nil,
@@ -5171,6 +5257,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",
@@ -5197,6 +5284,7 @@
}
func TestCompatConfig(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5231,6 +5319,7 @@
}
func TestRejectNonInstallableJavaLibrary(t *testing.T) {
+ t.Parallel()
testApexError(t, `"myjar" is not configured to be compiled into dex`, `
apex {
name: "myapex",
@@ -5256,6 +5345,7 @@
}
func TestCarryRequiredModuleNames(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -5294,6 +5384,7 @@
}
func TestSymlinksFromApexToSystem(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",
@@ -5423,6 +5514,7 @@
}
func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@@ -5474,6 +5566,7 @@
}
func TestApexWithJniLibs(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5515,6 +5608,7 @@
}
func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5536,6 +5630,7 @@
}
func TestAppBundle(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5566,6 +5661,7 @@
}
func TestAppSetBundle(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -5740,6 +5836,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",
@@ -5756,6 +5853,7 @@
}
func TestNoUpdatableJarsInBootImage(t *testing.T) {
+ t.Parallel()
var err string
var transform func(*dexpreopt.GlobalConfig)
@@ -5892,6 +5990,7 @@
}
func TestApexPermittedPackagesRules(t *testing.T) {
+ t.Parallel()
testcases := []struct {
name string
expectedError string
@@ -5975,6 +6074,7 @@
}
func TestTestFor(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -6032,6 +6132,7 @@
}
func TestApexSet(t *testing.T) {
+ t.Parallel()
ctx, config := testApex(t, `
apex_set {
name: "myapex",
@@ -6071,6 +6172,7 @@
}
func TestNoStaticLinkingToStubsLib(t *testing.T) {
+ t.Parallel()
testApexError(t, `.*required by "mylib" is a native library providing stub.*`, `
apex {
name: "myapex",
@@ -6107,6 +6209,7 @@
}
func TestApexKeysTxt(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -6147,6 +6250,7 @@
}
func TestAllowedFiles(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@@ -6202,6 +6306,7 @@
}
func TestNonPreferredPrebuiltDependency(t *testing.T) {
+ t.Parallel()
_, _ = testApex(t, `
apex {
name: "myapex",
diff --git a/apex/vndk_test.go b/apex/vndk_test.go
index 60b6ed5..e623990 100644
--- a/apex/vndk_test.go
+++ b/apex/vndk_test.go
@@ -9,6 +9,7 @@
)
func TestVndkApexForVndkLite(t *testing.T) {
+ t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@@ -62,6 +63,7 @@
}
func TestVndkApexUsesVendorVariant(t *testing.T) {
+ t.Parallel()
bp := `
apex_vndk {
name: "myapex",