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/cc/cc_test.go b/cc/cc_test.go
index e0d4640..8d00239 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -128,6 +128,7 @@
)
func TestFuchsiaDeps(t *testing.T) {
+ t.Parallel()
t.Helper()
bp := `
@@ -165,6 +166,7 @@
}
func TestFuchsiaTargetDecl(t *testing.T) {
+ t.Parallel()
t.Helper()
bp := `
@@ -191,6 +193,7 @@
}
func TestVendorSrc(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libTest",
@@ -321,6 +324,7 @@
}
func TestVndk(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -447,6 +451,7 @@
}
func TestVndkWithHostSupported(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libvndk_host_supported",
@@ -481,6 +486,7 @@
}
func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
+ t.Parallel()
bp := `
vndk_libraries_txt {
name: "llndk.libraries.txt",
@@ -496,6 +502,7 @@
}
func TestVndkUsingCoreVariant(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -543,6 +550,7 @@
}
func TestDataLibs(t *testing.T) {
+ t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@@ -593,6 +601,7 @@
}
func TestDataLibsRelativeInstallPath(t *testing.T) {
+ t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@@ -640,6 +649,7 @@
}
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
+ t.Parallel()
ctx := testCcNoVndk(t, `
cc_library {
name: "libvndk",
@@ -663,6 +673,7 @@
}
func TestVndkDepError(t *testing.T) {
+ t.Parallel()
// Check whether an error is emitted when a VNDK lib depends on a system lib.
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
cc_library {
@@ -842,6 +853,7 @@
}
func TestDoubleLoadbleDep(t *testing.T) {
+ t.Parallel()
// okay to link : LLNDK -> double_loadable VNDK
testCc(t, `
cc_library {
@@ -947,6 +959,7 @@
}
func TestVendorSnapshotCapture(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -1080,6 +1093,7 @@
}
func TestVendorSnapshotUse(t *testing.T) {
+ t.Parallel()
frameworkBp := `
cc_library {
name: "libvndk",
@@ -1289,6 +1303,7 @@
}
func TestVendorSnapshotSanitizer(t *testing.T) {
+ t.Parallel()
bp := `
vendor_snapshot_static {
name: "libsnapshot",
@@ -1329,6 +1344,7 @@
}
func TestVendorSnapshotExclude(t *testing.T) {
+ t.Parallel()
// This test verifies that the exclude_from_vendor_snapshot property
// makes its way from the Android.bp source file into the module data
@@ -1436,6 +1452,7 @@
}
func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
+ t.Parallel()
// This test verifies that using the exclude_from_vendor_snapshot
// property on a module in a vendor proprietary path generates an
@@ -1476,6 +1493,7 @@
}
func TestVendorSnapshotExcludeWithVendorAvailable(t *testing.T) {
+ t.Parallel()
// This test verifies that using the exclude_from_vendor_snapshot
// property on a module that is vendor available generates an error. A
@@ -1519,6 +1537,7 @@
}
func TestDoubleLoadableDepError(t *testing.T) {
+ t.Parallel()
// Check whether an error is emitted when a LLNDK depends on a non-double_loadable VNDK lib.
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
cc_library {
@@ -1639,6 +1658,7 @@
}
func TestVndkExt(t *testing.T) {
+ t.Parallel()
// This test checks the VNDK-Ext properties.
bp := `
cc_library {
@@ -1721,6 +1741,7 @@
}
func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
+ t.Parallel()
// This test checks the VNDK-Ext properties when BOARD_VNDK_VERSION is not set.
ctx := testCcNoVndk(t, `
cc_library {
@@ -1751,6 +1772,7 @@
}
func TestVndkExtWithoutProductVndkVersion(t *testing.T) {
+ t.Parallel()
// This test checks the VNDK-Ext properties when PRODUCT_PRODUCT_VNDK_VERSION is not set.
ctx := testCc(t, `
cc_library {
@@ -1781,6 +1803,7 @@
}
func TestVndkExtError(t *testing.T) {
+ t.Parallel()
// This test ensures an error is emitted in ill-formed vndk-ext definition.
testCcError(t, "must set `vendor: true` or `product_specific: true` to set `extends: \".*\"`", `
cc_library {
@@ -1866,6 +1889,7 @@
}
func TestVndkExtInconsistentSupportSystemProcessError(t *testing.T) {
+ t.Parallel()
// This test ensures an error is emitted for inconsistent support_system_process.
testCcError(t, "module \".*\" with mismatched support_system_process", `
cc_library {
@@ -1913,6 +1937,7 @@
}
func TestVndkExtVendorAvailableFalseError(t *testing.T) {
+ t.Parallel()
// This test ensures an error is emitted when a VNDK-Ext library extends a VNDK library
// with `vendor_available: false`.
testCcError(t, "`extends` refers module \".*\" which does not have `vendor_available: true`", `
@@ -1959,6 +1984,7 @@
}
func TestVendorModuleUseVndkExt(t *testing.T) {
+ t.Parallel()
// This test ensures a vendor module can depend on a VNDK-Ext library.
testCc(t, `
cc_library {
@@ -2011,6 +2037,7 @@
}
func TestVndkExtUseVendorLib(t *testing.T) {
+ t.Parallel()
// This test ensures a VNDK-Ext library can depend on a vendor library.
testCc(t, `
cc_library {
@@ -2073,6 +2100,7 @@
}
func TestProductVndkExtDependency(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -2138,6 +2166,7 @@
}
func TestVndkSpExtUseVndkError(t *testing.T) {
+ t.Parallel()
// This test ensures an error is emitted if a VNDK-SP-Ext library depends on a VNDK
// library.
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
@@ -2220,6 +2249,7 @@
}
func TestVndkUseVndkExtError(t *testing.T) {
+ t.Parallel()
// This test ensures an error is emitted if a VNDK/VNDK-SP library depends on a
// VNDK-Ext/VNDK-SP-Ext library.
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
@@ -2359,6 +2389,7 @@
}
func TestEnforceProductVndkVersion(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libllndk",
@@ -2433,6 +2464,7 @@
}
func TestEnforceProductVndkVersionErrors(t *testing.T) {
+ t.Parallel()
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
cc_library {
name: "libprod",
@@ -2513,6 +2545,7 @@
}
func TestMakeLinkType(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -2706,6 +2739,7 @@
}
func TestSplitListForSize(t *testing.T) {
+ t.Parallel()
for _, testCase := range splitListForSizeTestCases {
out, _ := splitListForSize(android.PathsForTesting(testCase.in...), testCase.size)
@@ -2891,6 +2925,7 @@
}
func TestLinkReordering(t *testing.T) {
+ t.Parallel()
for _, testCase := range staticLinkDepOrderTestCases {
errs := []string{}
@@ -2953,6 +2988,7 @@
}
func TestStaticLibDepReordering(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@@ -2991,6 +3027,7 @@
}
func TestStaticLibDepReorderingWithShared(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@@ -3037,6 +3074,7 @@
}
func TestLlndkLibrary(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libllndk",
@@ -3065,6 +3103,7 @@
}
func TestLlndkHeaders(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
llndk_headers {
name: "libllndk_headers",
@@ -3158,6 +3197,7 @@
`
func TestRuntimeLibs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
// runtime_libs for core variants use the module names without suffixes.
@@ -3181,6 +3221,7 @@
}
func TestExcludeRuntimeLibs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
variant := "android_arm64_armv8-a_shared"
@@ -3193,6 +3234,7 @@
}
func TestRuntimeLibsNoVndk(t *testing.T) {
+ t.Parallel()
ctx := testCcNoVndk(t, runtimeLibAndroidBp)
// If DeviceVndkVersion is not defined, then runtime_libs are copied as-is.
@@ -3230,6 +3272,7 @@
`
func TestStaticLibDepExport(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, staticLibAndroidBp)
// Check the shared version of lib2.
@@ -3317,6 +3360,7 @@
}
func TestCompilerFlags(t *testing.T) {
+ t.Parallel()
for _, testCase := range compilerFlagsTestCases {
ctx := &mockContext{result: true}
CheckBadCompilerFlags(ctx, "", []string{testCase.in})
@@ -3330,6 +3374,7 @@
}
func TestVendorPublicLibraries(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "libvendorpublic_headers",
@@ -3396,6 +3441,7 @@
}
func TestRecovery(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "librecovery",
@@ -3431,6 +3477,7 @@
}
func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
+ t.Parallel()
bp := `
cc_prebuilt_test_library_shared {
name: "test_lib",
@@ -3477,6 +3524,7 @@
}
func TestVersionedStubs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "libFoo",
@@ -3541,6 +3589,7 @@
}
func TestVersioningMacro(t *testing.T) {
+ t.Parallel()
for _, tc := range []struct{ moduleName, expected string }{
{"libc", "__LIBC_API__"},
{"libfoo", "__LIBFOO_API__"},
@@ -3553,6 +3602,7 @@
}
func TestStaticExecutable(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "static_test",
@@ -3578,6 +3628,7 @@
}
func TestStaticDepsOrderWithStubs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "mybin",
@@ -3618,6 +3669,7 @@
}
func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
+ t.Parallel()
testCcError(t, `module "libA" .* depends on disabled module "libB"`, `
cc_library {
name: "libA",
@@ -3638,6 +3690,7 @@
// Simple smoke test for the cc_fuzz target that ensures the rule compiles
// correctly.
func TestFuzzTarget(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_fuzz {
name: "fuzz_smoke_test",
@@ -3649,6 +3702,7 @@
}
func TestAidl(t *testing.T) {
+ t.Parallel()
}
func assertString(t *testing.T, got, expected string) {
@@ -3679,6 +3733,7 @@
}
func TestDefaults(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_defaults {
name: "defaults",
@@ -3743,6 +3798,7 @@
}
func TestProductVariableDefaults(t *testing.T) {
+ t.Parallel()
bp := `
cc_defaults {
name: "libfoo_defaults",
diff --git a/cc/compiler_test.go b/cc/compiler_test.go
index c301388..cf553bd 100644
--- a/cc/compiler_test.go
+++ b/cc/compiler_test.go
@@ -19,6 +19,7 @@
)
func TestIsThirdParty(t *testing.T) {
+ t.Parallel()
shouldFail := []string{
"external/foo/",
"vendor/bar/",
diff --git a/cc/config/tidy_test.go b/cc/config/tidy_test.go
index 4ed8b23..3ea2f6b 100644
--- a/cc/config/tidy_test.go
+++ b/cc/config/tidy_test.go
@@ -19,6 +19,7 @@
)
func TestTidyChecksForDir(t *testing.T) {
+ t.Parallel()
testCases := []struct {
input string
expected string
diff --git a/cc/gen_test.go b/cc/gen_test.go
index 4b9a36e..ee89873 100644
--- a/cc/gen_test.go
+++ b/cc/gen_test.go
@@ -21,6 +21,7 @@
)
func TestGen(t *testing.T) {
+ t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library_shared {
diff --git a/cc/genrule_test.go b/cc/genrule_test.go
index a366f76..6623d20 100644
--- a/cc/genrule_test.go
+++ b/cc/genrule_test.go
@@ -30,6 +30,7 @@
}
func TestArchGenruleCmd(t *testing.T) {
+ t.Parallel()
fs := map[string][]byte{
"tool": nil,
"foo": nil,
@@ -78,6 +79,7 @@
}
func TestLibraryGenruleCmd(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libboth",
diff --git a/cc/library_headers_test.go b/cc/library_headers_test.go
index 564ef61..db42d25 100644
--- a/cc/library_headers_test.go
+++ b/cc/library_headers_test.go
@@ -20,6 +20,7 @@
)
func TestLibraryHeaders(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "headers",
@@ -41,6 +42,7 @@
}
func TestPrebuiltLibraryHeaders(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_prebuilt_library_headers {
name: "headers",
diff --git a/cc/library_test.go b/cc/library_test.go
index 49838b4..d42f073 100644
--- a/cc/library_test.go
+++ b/cc/library_test.go
@@ -22,6 +22,7 @@
)
func TestLibraryReuse(t *testing.T) {
+ t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library {
@@ -190,6 +191,7 @@
}
func TestStubsVersions(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libfoo",
@@ -213,6 +215,7 @@
}
func TestStubsVersions_NotSorted(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libfoo",
@@ -228,6 +231,7 @@
}
func TestStubsVersions_ParseError(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libfoo",
diff --git a/cc/object_test.go b/cc/object_test.go
index 6ff8a00..a006044 100644
--- a/cc/object_test.go
+++ b/cc/object_test.go
@@ -19,6 +19,7 @@
)
func TestLinkerScript(t *testing.T) {
+ t.Parallel()
t.Run("script", func(t *testing.T) {
testCc(t, `
cc_object {
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index 52416ac..afae261 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -43,6 +43,7 @@
}
func TestPrebuilt(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "liba",
@@ -172,6 +173,7 @@
}
func TestPrebuiltLibraryShared(t *testing.T) {
+ t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_shared {
name: "libtest",
@@ -189,6 +191,7 @@
}
func TestPrebuiltLibraryStatic(t *testing.T) {
+ t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_static {
name: "libtest",
@@ -203,6 +206,7 @@
}
func TestPrebuiltLibrary(t *testing.T) {
+ t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library {
name: "libtest",
@@ -229,6 +233,7 @@
}
func TestPrebuiltLibraryStem(t *testing.T) {
+ t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library {
name: "libfoo",
@@ -256,6 +261,7 @@
}
func TestPrebuiltLibrarySharedStem(t *testing.T) {
+ t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_shared {
name: "libfoo",
@@ -274,6 +280,7 @@
}
func TestPrebuiltSymlinkedHostBinary(t *testing.T) {
+ t.Parallel()
if android.BuildOs != android.Linux {
t.Skipf("Skipping host prebuilt testing that is only supported on %s not %s", android.Linux, android.BuildOs)
}
diff --git a/cc/proto_test.go b/cc/proto_test.go
index f8bbd26..2d059eb 100644
--- a/cc/proto_test.go
+++ b/cc/proto_test.go
@@ -22,6 +22,7 @@
)
func TestProto(t *testing.T) {
+ t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library_shared {
diff --git a/cc/sdk_test.go b/cc/sdk_test.go
index 5a3c181..7b9867c 100644
--- a/cc/sdk_test.go
+++ b/cc/sdk_test.go
@@ -21,6 +21,7 @@
)
func TestSdkMutator(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libsdk",
diff --git a/cc/test_data_test.go b/cc/test_data_test.go
index ae59e2f..7908aa0 100644
--- a/cc/test_data_test.go
+++ b/cc/test_data_test.go
@@ -109,6 +109,7 @@
}
func TestDataTests(t *testing.T) {
+ t.Parallel()
buildDir, err := ioutil.TempDir("", "soong_test_test")
if err != nil {
t.Fatal(err)