Make more cc tests parallel
Test: go test soong cc tests
Change-Id: I5ade33b1579ae46571728e051471147e627a7d38
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 6a22bd0..6dfd395 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -154,6 +154,7 @@
}
func TestVendorSrc(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libTest",
@@ -220,6 +221,7 @@
}
func TestInstallPartition(t *testing.T) {
+ t.Parallel()
t.Helper()
ctx := prepareForCcTest.RunTestWithBp(t, `
cc_library {
@@ -352,6 +354,7 @@
}
func TestVndk(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -569,6 +572,7 @@
}
func TestVndkWithHostSupported(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libvndk_host_supported",
@@ -605,6 +609,7 @@
}
func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
+ t.Parallel()
bp := `
llndk_libraries_txt {
name: "llndk.libraries.txt",
@@ -621,6 +626,7 @@
}
func TestVndkUsingCoreVariant(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -673,6 +679,7 @@
}
func TestDataLibs(t *testing.T) {
+ t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@@ -723,6 +730,7 @@
}
func TestDataLibsRelativeInstallPath(t *testing.T) {
+ t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@@ -781,6 +789,7 @@
}
func TestTestBinaryTestSuites(t *testing.T) {
+ t.Parallel()
bp := `
cc_test {
name: "main_test",
@@ -812,6 +821,7 @@
}
func TestTestLibraryTestSuites(t *testing.T) {
+ t.Parallel()
bp := `
cc_test_library {
name: "main_test_lib",
@@ -843,6 +853,7 @@
}
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
+ t.Parallel()
ctx := testCcNoVndk(t, `
cc_library {
name: "libvndk",
@@ -899,6 +910,7 @@
}
func TestVndkModuleError(t *testing.T) {
+ t.Parallel()
// Check the error message for vendor_available and product_available properties.
testCcErrorProductVndk(t, "vndk: vendor_available must be set to true when `vndk: {enabled: true}`", `
cc_library {
@@ -940,6 +952,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 {
@@ -1131,6 +1144,7 @@
}
func TestDoubleLoadbleDep(t *testing.T) {
+ t.Parallel()
// okay to link : LLNDK -> double_loadable VNDK
testCc(t, `
cc_library {
@@ -1235,6 +1249,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 {
@@ -1317,6 +1332,7 @@
}
func TestCheckVndkMembershipBeforeDoubleLoadable(t *testing.T) {
+ t.Parallel()
testCcError(t, "module \"libvndksp\" variant .*: .*: VNDK-SP must only depend on VNDK-SP", `
cc_library {
name: "libvndksp",
@@ -1342,6 +1358,7 @@
}
func TestVndkExt(t *testing.T) {
+ t.Parallel()
// This test checks the VNDK-Ext properties.
bp := `
cc_library {
@@ -1429,6 +1446,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 {
@@ -1460,6 +1478,7 @@
}
func TestVndkExtWithoutProductVndkVersion(t *testing.T) {
+ t.Parallel()
// This test checks the VNDK-Ext properties when PRODUCT_PRODUCT_VNDK_VERSION is not set.
ctx := testCcNoProductVndk(t, `
cc_library {
@@ -1491,6 +1510,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 {
@@ -1581,6 +1601,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 {
@@ -1630,6 +1651,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 `private: true`.
testCcError(t, "`extends` refers module \".*\" which has `private: true`", `
@@ -1680,6 +1702,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 {
@@ -1734,6 +1757,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 {
@@ -1798,6 +1822,7 @@
}
func TestProductVndkExtDependency(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -1865,6 +1890,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 \".*\"", `
@@ -1951,6 +1977,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", `
@@ -2096,6 +2123,7 @@
}
func TestEnforceProductVndkVersion(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libllndk",
@@ -2221,6 +2249,7 @@
}
func TestEnforceProductVndkVersionErrors(t *testing.T) {
+ t.Parallel()
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.29", `
cc_library {
name: "libprod",
@@ -2318,6 +2347,7 @@
}
func TestMakeLinkType(t *testing.T) {
+ t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -2609,6 +2639,7 @@
}
func TestStaticLibDepReordering(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@@ -2648,6 +2679,7 @@
}
func TestStaticLibDepReorderingWithShared(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@@ -2695,6 +2727,7 @@
}
func TestLlndkLibrary(t *testing.T) {
+ t.Parallel()
result := prepareForCcTest.RunTestWithBp(t, `
cc_library {
name: "libllndk",
@@ -2782,6 +2815,7 @@
}
func TestLlndkHeaders(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "libllndk_headers",
@@ -2914,6 +2948,7 @@
`
func TestRuntimeLibs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
// runtime_libs for core variants use the module names without suffixes.
@@ -2950,6 +2985,7 @@
}
func TestExcludeRuntimeLibs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
variant := "android_arm64_armv8-a_shared"
@@ -2962,6 +2998,7 @@
}
func TestRuntimeLibsNoVndk(t *testing.T) {
+ t.Parallel()
ctx := testCcNoVndk(t, runtimeLibAndroidBp)
// If DeviceVndkVersion is not defined, then runtime_libs are copied as-is.
@@ -3002,6 +3039,7 @@
`
func TestStaticLibDepExport(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, staticLibAndroidBp)
// Check the shared version of lib2.
@@ -3089,6 +3127,7 @@
}
func TestCompilerFlags(t *testing.T) {
+ t.Parallel()
for _, testCase := range compilerFlagsTestCases {
ctx := &mockContext{result: true}
CheckBadCompilerFlags(ctx, "", []string{testCase.in})
@@ -3102,6 +3141,7 @@
}
func TestRecovery(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "librecovery",
@@ -3137,6 +3177,7 @@
}
func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
+ t.Parallel()
bp := `
cc_prebuilt_test_library_shared {
name: "test_lib",
@@ -3183,6 +3224,7 @@
}
func TestVersionedStubs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "libFoo",
@@ -3249,6 +3291,7 @@
}
func TestVersioningMacro(t *testing.T) {
+ t.Parallel()
for _, tc := range []struct{ moduleName, expected string }{
{"libc", "__LIBC_API__"},
{"libfoo", "__LIBFOO_API__"},
@@ -3269,6 +3312,7 @@
}
func TestStaticLibArchiveArgs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_static {
name: "foo",
@@ -3309,6 +3353,7 @@
}
func TestSharedLibLinkingArgs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_static {
name: "foo",
@@ -3357,6 +3402,7 @@
}
func TestStaticExecutable(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "static_test",
@@ -3382,6 +3428,7 @@
}
func TestStaticDepsOrderWithStubs(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "mybin",
@@ -3422,6 +3469,7 @@
}
func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
+ t.Parallel()
testCcError(t, `module "libA" .* depends on disabled module "libB"`, `
cc_library {
name: "libA",
@@ -3549,10 +3597,12 @@
}
func TestAFLFuzzTargetForDevice(t *testing.T) {
+ t.Parallel()
VerifyAFLFuzzTargetVariant(t, "android_arm64_armv8-a")
}
func TestAFLFuzzTargetForLinuxHost(t *testing.T) {
+ t.Parallel()
if runtime.GOOS != "linux" {
t.Skip("requires linux")
}
@@ -3563,6 +3613,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",
@@ -3573,9 +3624,6 @@
ctx.ModuleForTests("fuzz_smoke_test", variant).Rule("cc")
}
-func TestAidl(t *testing.T) {
-}
-
func assertString(t *testing.T, got, expected string) {
t.Helper()
if got != expected {
@@ -3604,6 +3652,7 @@
}
func TestDefaults(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_defaults {
name: "defaults",
@@ -3663,6 +3712,7 @@
}
func TestProductVariableDefaults(t *testing.T) {
+ t.Parallel()
bp := `
cc_defaults {
name: "libfoo_defaults",
@@ -3724,6 +3774,7 @@
}
func TestInstallSharedLibs(t *testing.T) {
+ t.Parallel()
bp := `
cc_binary {
name: "bin",
@@ -3819,6 +3870,7 @@
}
func TestStubsLibReexportsHeaders(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "libclient",
@@ -3851,6 +3903,7 @@
}
func TestAidlFlagsPassedToTheAidlCompiler(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libfoo",
@@ -3869,6 +3922,7 @@
}
func TestAidlFlagsWithMinSdkVersion(t *testing.T) {
+ t.Parallel()
for _, tc := range []struct {
name string
sdkVersion string
@@ -3921,6 +3975,7 @@
}
func TestMinSdkVersionInClangTriple(t *testing.T) {
+ t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "libfoo",
@@ -3933,6 +3988,7 @@
}
func TestNonDigitMinSdkVersionInClangTriple(t *testing.T) {
+ t.Parallel()
bp := `
cc_library_shared {
name: "libfoo",
@@ -3952,6 +4008,7 @@
}
func TestIncludeDirsExporting(t *testing.T) {
+ t.Parallel()
// Trim spaces from the beginning, end and immediately after any newline characters. Leaves
// embedded newline characters alone.
@@ -4223,6 +4280,7 @@
}
func TestIncludeDirectoryOrdering(t *testing.T) {
+ t.Parallel()
baseExpectedFlags := []string{
"${config.ArmThumbCflags}",
"${config.ArmCflags}",
@@ -4426,6 +4484,7 @@
}
func TestCcBuildBrokenClangProperty(t *testing.T) {
+ t.Parallel()
tests := []struct {
name string
clang bool
@@ -4476,6 +4535,7 @@
}
func TestCcBuildBrokenClangAsFlags(t *testing.T) {
+ t.Parallel()
tests := []struct {
name string
clangAsFlags []string
@@ -4521,6 +4581,7 @@
}
func TestCcBuildBrokenClangCFlags(t *testing.T) {
+ t.Parallel()
tests := []struct {
name string
clangCFlags []string