summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2020-09-18 14:25:31 -0700
committerColin Cross <ccross@android.com>2020-10-06 15:12:22 -0700
commit323dc60712491c71ccdc5363c42df61f0a192487 (patch)
tree5ba86007fb0f7d2536671cbc64e91b1eac304270 /java/java_test.go
parent56a8321c210bf73c7b9f177849ff4a6b6192d237 (diff)
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
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index f16639aa8..4424999cc 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -177,6 +177,7 @@ func moduleToPath(name string) string {
}
func TestJavaLinkType(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_library {
name: "foo",
@@ -265,6 +266,7 @@ func TestJavaLinkType(t *testing.T) {
}
func TestSimple(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -309,6 +311,7 @@ func TestSimple(t *testing.T) {
}
func TestExportedPlugins(t *testing.T) {
+ t.Parallel()
type Result struct {
library string
processors string
@@ -392,6 +395,7 @@ func TestExportedPlugins(t *testing.T) {
}
func TestSdkVersionByPartition(t *testing.T) {
+ t.Parallel()
testJavaError(t, "sdk_version must have a value when the module is located at vendor or product", `
java_library {
name: "foo",
@@ -427,6 +431,7 @@ func TestSdkVersionByPartition(t *testing.T) {
}
func TestArchSpecific(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -446,6 +451,7 @@ func TestArchSpecific(t *testing.T) {
}
func TestBinary(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library_host {
name: "foo",
@@ -474,6 +480,7 @@ func TestBinary(t *testing.T) {
}
func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) {
+ t.Parallel()
bp := `
java_library {
name: "target_library",
@@ -509,6 +516,7 @@ func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) {
}
func TestPrebuilts(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -604,6 +612,7 @@ func assertDeepEquals(t *testing.T, message string, expected interface{}, actual
}
func TestJavaSdkLibraryImport(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -660,6 +669,7 @@ func TestJavaSdkLibraryImport(t *testing.T) {
}
func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "sdklib",
@@ -699,6 +709,7 @@ func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
}
func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "sdklib",
@@ -736,6 +747,7 @@ func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
}
func TestDefaults(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_defaults {
name: "defaults",
@@ -811,6 +823,7 @@ func TestDefaults(t *testing.T) {
}
func TestResources(t *testing.T) {
+ t.Parallel()
var table = []struct {
name string
prop string
@@ -917,6 +930,7 @@ func TestResources(t *testing.T) {
}
func TestIncludeSrcs(t *testing.T) {
+ t.Parallel()
ctx, _ := testJavaWithFS(t, `
java_library {
name: "foo",
@@ -984,6 +998,7 @@ func TestIncludeSrcs(t *testing.T) {
}
func TestGeneratedSources(t *testing.T) {
+ t.Parallel()
ctx, _ := testJavaWithFS(t, `
java_library {
name: "foo",
@@ -1020,6 +1035,7 @@ func TestGeneratedSources(t *testing.T) {
}
func TestTurbine(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -1069,6 +1085,7 @@ func TestTurbine(t *testing.T) {
}
func TestSharding(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "bar",
@@ -1087,6 +1104,7 @@ func TestSharding(t *testing.T) {
}
func TestDroiddoc(t *testing.T) {
+ t.Parallel()
ctx, _ := testJavaWithFS(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@@ -1165,6 +1183,7 @@ func TestDroiddoc(t *testing.T) {
}
func TestDroiddocArgsAndFlagsCausesError(t *testing.T) {
+ t.Parallel()
testJavaError(t, "flags is set. Cannot set args", `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@@ -1211,6 +1230,7 @@ func TestDroiddocArgsAndFlagsCausesError(t *testing.T) {
}
func TestDroidstubs(t *testing.T) {
+ t.Parallel()
ctx, _ := testJavaWithFS(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@@ -1267,6 +1287,7 @@ func TestDroidstubs(t *testing.T) {
}
func TestDroidstubsWithSystemModules(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
droidstubs {
name: "stubs-source-system-modules",
@@ -1326,6 +1347,7 @@ func checkSystemModulesUseByDroidstubs(t *testing.T, ctx *android.TestContext, m
}
func TestJarGenrules(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -1380,6 +1402,7 @@ func TestJarGenrules(t *testing.T) {
}
func TestExcludeFileGroupInSrcs(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -1406,6 +1429,7 @@ func TestExcludeFileGroupInSrcs(t *testing.T) {
}
func TestJavaLibrary(t *testing.T) {
+ t.Parallel()
config := testConfig(nil, "", map[string][]byte{
"libcore/Android.bp": []byte(`
java_library {
@@ -1419,6 +1443,7 @@ func TestJavaLibrary(t *testing.T) {
}
func TestJavaSdkLibrary(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@@ -1557,6 +1582,7 @@ func TestJavaSdkLibrary(t *testing.T) {
}
func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "foo",
@@ -1582,6 +1608,7 @@ func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
}
func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@@ -1600,6 +1627,7 @@ func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
}
func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
+ t.Parallel()
testJavaError(t, `"foo" does not provide api scope system`, `
java_sdk_library {
name: "foo",
@@ -1618,6 +1646,7 @@ func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
}
func TestJavaSdkLibrary_Deps(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "sdklib",
@@ -1640,6 +1669,7 @@ func TestJavaSdkLibrary_Deps(t *testing.T) {
}
func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_sdk_library_import {
name: "foo",
@@ -1663,6 +1693,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
}
func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
+ t.Parallel()
bp := `
java_sdk_library_import {
name: "foo",
@@ -1711,6 +1742,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
}
func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
+ t.Parallel()
testJavaError(t, `module "foo": enabled api scope "system" depends on disabled scope "public"`, `
java_sdk_library {
name: "foo",
@@ -1729,6 +1761,7 @@ func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
}
func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@@ -1743,6 +1776,7 @@ func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
}
func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@@ -1759,6 +1793,7 @@ func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
}
func TestJavaSdkLibrary_SystemServer(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@@ -1775,6 +1810,7 @@ func TestJavaSdkLibrary_SystemServer(t *testing.T) {
}
func TestJavaSdkLibrary_MissingScope(t *testing.T) {
+ t.Parallel()
testJavaError(t, `requires api scope module-lib from foo but it only has \[\] available`, `
java_sdk_library {
name: "foo",
@@ -1794,6 +1830,7 @@ func TestJavaSdkLibrary_MissingScope(t *testing.T) {
}
func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
+ t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@@ -1814,6 +1851,7 @@ func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
}
func TestJavaSdkLibrary_DefaultToStubs(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "foo",
@@ -1889,6 +1927,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}
CheckKotlincFlags(ctx, []string{testCase.in})
@@ -1919,6 +1958,7 @@ func checkPatchModuleFlag(t *testing.T, ctx *android.TestContext, moduleName str
}
func TestPatchModule(t *testing.T) {
+ t.Parallel()
t.Run("Java language level 8", func(t *testing.T) {
// Test with legacy javac -source 1.8 -target 1.8
bp := `
@@ -1984,6 +2024,7 @@ func TestPatchModule(t *testing.T) {
}
func TestJavaSystemModules(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_system_modules {
name: "system-modules",
@@ -2018,6 +2059,7 @@ func TestJavaSystemModules(t *testing.T) {
}
func TestJavaSystemModulesImport(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_system_modules_import {
name: "system-modules",
@@ -2048,6 +2090,7 @@ func TestJavaSystemModulesImport(t *testing.T) {
}
func TestJavaLibraryWithSystemModules(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "lib-with-source-system-modules",
@@ -2104,6 +2147,7 @@ func checkBootClasspathForSystemModule(t *testing.T, ctx *android.TestContext, m
}
func TestAidlExportIncludeDirsFromImports(t *testing.T) {
+ t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@@ -2128,6 +2172,7 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) {
}
func TestDataNativeBinaries(t *testing.T) {
+ t.Parallel()
ctx, config := testJava(t, `
java_test_host {
name: "foo",