From a2fdb61a04e444d308cae227f3ce0dfe571807d9 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 11 Oct 2024 12:52:56 -0700 Subject: 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 --- apex/bootclasspath_fragment_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'apex/bootclasspath_fragment_test.go') diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index e44d3f552..71a8246a7 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -47,6 +47,7 @@ var prepareForTestWithArtApex = android.GroupFixturePreparers( ) func TestBootclasspathFragments_FragmentDependency(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, // Configure some libraries in the art bootclasspath_fragment and platform_bootclasspath. @@ -178,6 +179,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) { } func TestBootclasspathFragmentInArtApex(t *testing.T) { + t.Parallel() commonPreparer := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, @@ -298,6 +300,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { } t.Run("boot image files from source", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( commonPreparer, @@ -329,6 +332,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("boot image files from source of override apex", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( commonPreparer, @@ -349,6 +353,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("generate boot image profile even if dexpreopt is disabled", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( commonPreparer, @@ -369,6 +374,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("boot image disable generate profile", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( commonPreparer, @@ -387,6 +393,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("boot image files with preferred prebuilt", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( commonPreparer, @@ -431,6 +438,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("source with inconsistency between config and contents", func(t *testing.T) { + t.Parallel() android.GroupFixturePreparers( commonPreparer, @@ -444,6 +452,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("prebuilt with inconsistency between config and contents", func(t *testing.T) { + t.Parallel() android.GroupFixturePreparers( commonPreparer, @@ -457,6 +466,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("preferred prebuilt with inconsistency between config and contents", func(t *testing.T) { + t.Parallel() android.GroupFixturePreparers( commonPreparer, @@ -473,6 +483,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { }) t.Run("source preferred and prebuilt with inconsistency between config and contents", func(t *testing.T) { + t.Parallel() android.GroupFixturePreparers( commonPreparer, @@ -491,6 +502,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { } func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { + t.Parallel() preparers := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, @@ -571,6 +583,7 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { ` t.Run("disabled alternative APEX", func(t *testing.T) { + t.Parallel() result := preparers.RunTestWithBp(t, fmt.Sprintf(bp, "enabled: false,")) java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{ @@ -614,6 +627,7 @@ func checkCopiesToPredefinedLocationForArt(t *testing.T, config android.Config, } func TestBootclasspathFragmentContentsNoName(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithMyapex, @@ -722,6 +736,7 @@ func getDexJarPath(result *android.TestResult, name string) string { // TestBootclasspathFragment_HiddenAPIList checks to make sure that the correct parameters are // passed to the hiddenapi list tool. func TestBootclasspathFragment_HiddenAPIList(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, @@ -877,6 +892,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) { // additional_stubs: ["android-non-updatable"] causes the source android-non-updatable modules to be // added to the hiddenapi list tool. func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, @@ -1050,6 +1066,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) { } func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithArtApex, @@ -1217,6 +1234,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) { // setting additional_stubs: ["android-non-updatable"] causes the prebuilt android-non-updatable // modules to be added to the hiddenapi list tool. func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, java.PrepareForTestWithDexpreopt, @@ -1377,6 +1395,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test } func TestBootclasspathFragmentProtoContainsMinSdkVersion(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, prepareForTestWithMyapex, -- cgit v1.2.3-59-g8ed1b