Make apex tests parallel
Mark all the apex tests and subtests with t.Parallel(), which will allow
the test runner to run them in parallel. Reduces the time required to
run the apex tests from 70s to 9.7s.
Test: go test ./apex
Flag: EXEMPT test only
Change-Id: I08bd3cb4d8eec1f9520c1118b4525aa79e95288e
diff --git a/apex/platform_bootclasspath_test.go b/apex/platform_bootclasspath_test.go
index f4da31e..9f9b0b4 100644
--- a/apex/platform_bootclasspath_test.go
+++ b/apex/platform_bootclasspath_test.go
@@ -36,6 +36,7 @@
)
func TestPlatformBootclasspath_Fragments(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
prepareForTestWithMyapex,
@@ -178,6 +179,7 @@
//
// TODO: Remove once all prebuilts use the filtered_... properties.
func TestPlatformBootclasspath_LegacyPrebuiltFragment(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
java.FixtureConfigureApexBootJars("myapex:foo"),
@@ -243,6 +245,7 @@
}
func TestPlatformBootclasspathDependencies(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
prepareForTestWithArtApex,
@@ -418,6 +421,7 @@
// TestPlatformBootclasspath_AlwaysUsePrebuiltSdks verifies that the build does not fail when
// AlwaysUsePrebuiltSdk() returns true.
func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
prepareForTestWithMyapex,
@@ -594,6 +598,7 @@
// platform_bootclasspath's classpaths.proto config, if the apex does not generate its own config
// by setting generate_classpaths_proto property to false.
func TestPlatformBootclasspath_IncludesRemainingApexJars(t *testing.T) {
+ t.Parallel()
result := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
prepareForTestWithMyapex,
@@ -653,6 +658,7 @@
}
func TestBootJarNotInApex(t *testing.T) {
+ t.Parallel()
android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
PrepareForTestWithApexBuildComponents,
@@ -699,6 +705,7 @@
}
func TestBootFragmentNotInApex(t *testing.T) {
+ t.Parallel()
android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
PrepareForTestWithApexBuildComponents,
@@ -742,6 +749,7 @@
}
func TestNonBootJarInFragment(t *testing.T) {
+ t.Parallel()
android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath,
PrepareForTestWithApexBuildComponents,
@@ -800,6 +808,7 @@
// Skip bcp_fragment content validation of source apexes if prebuilts are active.
func TestNonBootJarInPrebuilts(t *testing.T) {
+ t.Parallel()
testCases := []struct {
description string
selectedApexContributions string
@@ -922,6 +931,7 @@
// Source and prebuilt apex provide different set of boot jars
func TestNonBootJarMissingInPrebuiltFragment(t *testing.T) {
+ t.Parallel()
bp := `
apex {
name: "myapex",