Merge "Make lots of tests run in parallel"

This commit is contained in:
Colin Cross
2020-10-07 20:40:38 +00:00
committed by Gerrit Code Review
117 changed files with 661 additions and 0 deletions

View File

@@ -128,6 +128,7 @@ const (
)
func TestFuchsiaDeps(t *testing.T) {
t.Parallel()
t.Helper()
bp := `
@@ -165,6 +166,7 @@ func TestFuchsiaDeps(t *testing.T) {
}
func TestFuchsiaTargetDecl(t *testing.T) {
t.Parallel()
t.Helper()
bp := `
@@ -191,6 +193,7 @@ func TestFuchsiaTargetDecl(t *testing.T) {
}
func TestVendorSrc(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libTest",
@@ -321,6 +324,7 @@ func checkVndkLibrariesOutput(t *testing.T, ctx *android.TestContext, module str
}
func TestVndk(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -447,6 +451,7 @@ func TestVndk(t *testing.T) {
}
func TestVndkWithHostSupported(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libvndk_host_supported",
@@ -481,6 +486,7 @@ func TestVndkWithHostSupported(t *testing.T) {
}
func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
t.Parallel()
bp := `
vndk_libraries_txt {
name: "llndk.libraries.txt",
@@ -496,6 +502,7 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
}
func TestVndkUsingCoreVariant(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -543,6 +550,7 @@ func TestVndkUsingCoreVariant(t *testing.T) {
}
func TestDataLibs(t *testing.T) {
t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@@ -593,6 +601,7 @@ func TestDataLibs(t *testing.T) {
}
func TestDataLibsRelativeInstallPath(t *testing.T) {
t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@@ -640,6 +649,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
}
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
t.Parallel()
ctx := testCcNoVndk(t, `
cc_library {
name: "libvndk",
@@ -663,6 +673,7 @@ func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
}
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 TestVndkDepError(t *testing.T) {
}
func TestDoubleLoadbleDep(t *testing.T) {
t.Parallel()
// okay to link : LLNDK -> double_loadable VNDK
testCc(t, `
cc_library {
@@ -947,6 +959,7 @@ func TestDoubleLoadbleDep(t *testing.T) {
}
func TestVendorSnapshotCapture(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -1080,6 +1093,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
}
func TestVendorSnapshotUse(t *testing.T) {
t.Parallel()
frameworkBp := `
cc_library {
name: "libvndk",
@@ -1289,6 +1303,7 @@ func TestVendorSnapshotUse(t *testing.T) {
}
func TestVendorSnapshotSanitizer(t *testing.T) {
t.Parallel()
bp := `
vendor_snapshot_static {
name: "libsnapshot",
@@ -1329,6 +1344,7 @@ func assertExcludeFromVendorSnapshotIs(t *testing.T, c *Module, expected bool) {
}
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 TestVendorSnapshotExclude(t *testing.T) {
}
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 TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
}
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 TestVendorSnapshotExcludeWithVendorAvailable(t *testing.T) {
}
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 TestDoubleLoadableDepError(t *testing.T) {
}
func TestVndkExt(t *testing.T) {
t.Parallel()
// This test checks the VNDK-Ext properties.
bp := `
cc_library {
@@ -1721,6 +1741,7 @@ func TestVndkExt(t *testing.T) {
}
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 TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
}
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 TestVndkExtWithoutProductVndkVersion(t *testing.T) {
}
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 TestVndkExtError(t *testing.T) {
}
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 TestVndkExtInconsistentSupportSystemProcessError(t *testing.T) {
}
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 TestVndkExtVendorAvailableFalseError(t *testing.T) {
}
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 TestVendorModuleUseVndkExt(t *testing.T) {
}
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 TestVndkExtUseVendorLib(t *testing.T) {
}
func TestProductVndkExtDependency(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -2138,6 +2166,7 @@ func TestProductVndkExtDependency(t *testing.T) {
}
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 TestVndkSpExtUseVndkError(t *testing.T) {
}
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 TestVndkUseVndkExtError(t *testing.T) {
}
func TestEnforceProductVndkVersion(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libllndk",
@@ -2433,6 +2464,7 @@ func TestEnforceProductVndkVersion(t *testing.T) {
}
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 TestEnforceProductVndkVersionErrors(t *testing.T) {
}
func TestMakeLinkType(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@@ -2706,6 +2739,7 @@ var splitListForSizeTestCases = []struct {
}
func TestSplitListForSize(t *testing.T) {
t.Parallel()
for _, testCase := range splitListForSizeTestCases {
out, _ := splitListForSize(android.PathsForTesting(testCase.in...), testCase.size)
@@ -2891,6 +2925,7 @@ func parseModuleDeps(text string) (modulesInOrder []android.Path, allDeps map[an
}
func TestLinkReordering(t *testing.T) {
t.Parallel()
for _, testCase := range staticLinkDepOrderTestCases {
errs := []string{}
@@ -2953,6 +2988,7 @@ func getOutputPaths(ctx *android.TestContext, variant string, moduleNames []stri
}
func TestStaticLibDepReordering(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@@ -2991,6 +3027,7 @@ func TestStaticLibDepReordering(t *testing.T) {
}
func TestStaticLibDepReorderingWithShared(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@@ -3037,6 +3074,7 @@ func checkEquals(t *testing.T, message string, expected, actual interface{}) {
}
func TestLlndkLibrary(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libllndk",
@@ -3065,6 +3103,7 @@ func TestLlndkLibrary(t *testing.T) {
}
func TestLlndkHeaders(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
llndk_headers {
name: "libllndk_headers",
@@ -3158,6 +3197,7 @@ const runtimeLibAndroidBp = `
`
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 TestRuntimeLibs(t *testing.T) {
}
func TestExcludeRuntimeLibs(t *testing.T) {
t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
variant := "android_arm64_armv8-a_shared"
@@ -3193,6 +3234,7 @@ func TestExcludeRuntimeLibs(t *testing.T) {
}
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 @@ const staticLibAndroidBp = `
`
func TestStaticLibDepExport(t *testing.T) {
t.Parallel()
ctx := testCc(t, staticLibAndroidBp)
// Check the shared version of lib2.
@@ -3317,6 +3360,7 @@ func (ctx *mockContext) PropertyErrorf(property, format string, args ...interfac
}
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 TestCompilerFlags(t *testing.T) {
}
func TestVendorPublicLibraries(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "libvendorpublic_headers",
@@ -3396,6 +3441,7 @@ func TestVendorPublicLibraries(t *testing.T) {
}
func TestRecovery(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "librecovery",
@@ -3431,6 +3477,7 @@ func TestRecovery(t *testing.T) {
}
func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
t.Parallel()
bp := `
cc_prebuilt_test_library_shared {
name: "test_lib",
@@ -3477,6 +3524,7 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
}
func TestVersionedStubs(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "libFoo",
@@ -3541,6 +3589,7 @@ func TestVersionedStubs(t *testing.T) {
}
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 TestVersioningMacro(t *testing.T) {
}
func TestStaticExecutable(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "static_test",
@@ -3578,6 +3628,7 @@ func TestStaticExecutable(t *testing.T) {
}
func TestStaticDepsOrderWithStubs(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "mybin",
@@ -3618,6 +3669,7 @@ func TestStaticDepsOrderWithStubs(t *testing.T) {
}
func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
t.Parallel()
testCcError(t, `module "libA" .* depends on disabled module "libB"`, `
cc_library {
name: "libA",
@@ -3638,6 +3690,7 @@ func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
// 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 TestFuzzTarget(t *testing.T) {
}
func TestAidl(t *testing.T) {
t.Parallel()
}
func assertString(t *testing.T, got, expected string) {
@@ -3679,6 +3733,7 @@ func assertMapKeys(t *testing.T, m map[string]string, expected []string) {
}
func TestDefaults(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_defaults {
name: "defaults",
@@ -3743,6 +3798,7 @@ func TestDefaults(t *testing.T) {
}
func TestProductVariableDefaults(t *testing.T) {
t.Parallel()
bp := `
cc_defaults {
name: "libfoo_defaults",

View File

@@ -19,6 +19,7 @@ import (
)
func TestIsThirdParty(t *testing.T) {
t.Parallel()
shouldFail := []string{
"external/foo/",
"vendor/bar/",

View File

@@ -19,6 +19,7 @@ import (
)
func TestTidyChecksForDir(t *testing.T) {
t.Parallel()
testCases := []struct {
input string
expected string

View File

@@ -21,6 +21,7 @@ import (
)
func TestGen(t *testing.T) {
t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library_shared {

View File

@@ -30,6 +30,7 @@ func testGenruleContext(config android.Config) *android.TestContext {
}
func TestArchGenruleCmd(t *testing.T) {
t.Parallel()
fs := map[string][]byte{
"tool": nil,
"foo": nil,
@@ -78,6 +79,7 @@ func TestArchGenruleCmd(t *testing.T) {
}
func TestLibraryGenruleCmd(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libboth",

View File

@@ -20,6 +20,7 @@ import (
)
func TestLibraryHeaders(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "headers",
@@ -41,6 +42,7 @@ func TestLibraryHeaders(t *testing.T) {
}
func TestPrebuiltLibraryHeaders(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_prebuilt_library_headers {
name: "headers",

View File

@@ -22,6 +22,7 @@ import (
)
func TestLibraryReuse(t *testing.T) {
t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library {
@@ -190,6 +191,7 @@ func TestLibraryReuse(t *testing.T) {
}
func TestStubsVersions(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libfoo",
@@ -213,6 +215,7 @@ func TestStubsVersions(t *testing.T) {
}
func TestStubsVersions_NotSorted(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libfoo",
@@ -228,6 +231,7 @@ func TestStubsVersions_NotSorted(t *testing.T) {
}
func TestStubsVersions_ParseError(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libfoo",

View File

@@ -19,6 +19,7 @@ import (
)
func TestLinkerScript(t *testing.T) {
t.Parallel()
t.Run("script", func(t *testing.T) {
testCc(t, `
cc_object {

View File

@@ -43,6 +43,7 @@ func testPrebuilt(t *testing.T, bp string, fs map[string][]byte) *android.TestCo
}
func TestPrebuilt(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "liba",
@@ -172,6 +173,7 @@ func TestPrebuilt(t *testing.T) {
}
func TestPrebuiltLibraryShared(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_shared {
name: "libtest",
@@ -189,6 +191,7 @@ func TestPrebuiltLibraryShared(t *testing.T) {
}
func TestPrebuiltLibraryStatic(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_static {
name: "libtest",
@@ -203,6 +206,7 @@ func TestPrebuiltLibraryStatic(t *testing.T) {
}
func TestPrebuiltLibrary(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library {
name: "libtest",
@@ -229,6 +233,7 @@ func TestPrebuiltLibrary(t *testing.T) {
}
func TestPrebuiltLibraryStem(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library {
name: "libfoo",
@@ -256,6 +261,7 @@ func TestPrebuiltLibraryStem(t *testing.T) {
}
func TestPrebuiltLibrarySharedStem(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_shared {
name: "libfoo",
@@ -274,6 +280,7 @@ func TestPrebuiltLibrarySharedStem(t *testing.T) {
}
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)
}

View File

@@ -22,6 +22,7 @@ import (
)
func TestProto(t *testing.T) {
t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library_shared {

View File

@@ -21,6 +21,7 @@ import (
)
func TestSdkMutator(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libsdk",

View File

@@ -109,6 +109,7 @@ var testDataTests = []struct {
}
func TestDataTests(t *testing.T) {
t.Parallel()
buildDir, err := ioutil.TempDir("", "soong_test_test")
if err != nil {
t.Fatal(err)