From aba8cd956a1f0cca137f6ab02b9791aac9435efd Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 5 Feb 2025 16:39:18 -0800 Subject: Add t.Parallel() to SDK tests Reduces time to run go test ./sdk from 44 seconds to 22.5 seconds. Requires moving snapshotTestCustomizations from a map to a struct with individual fields to avoid concurrent map accesses between subtests. Test: go test ./sdk Change-Id: Id6f451ba9cbace8bc7ea915033a795456b85cf3f --- sdk/sdk_test.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sdk/sdk_test.go') diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index 2532a2581..b525eb8a3 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { // Ensure that prebuilt modules have the same effective visibility as the source // modules. func TestSnapshotVisibility(t *testing.T) { + t.Parallel() packageBp := ` package { default_visibility: ["//other/foo"], @@ -160,6 +161,7 @@ java_import { } func TestSdkInstall(t *testing.T) { + t.Parallel() sdk := ` sdk { name: "mysdk", @@ -326,6 +328,7 @@ func TestCommonValueOptimization_InvalidArchSpecificVariants(t *testing.T) { // Ensure that sdk snapshot related environment variables work correctly. func TestSnapshot_EnvConfiguration(t *testing.T) { + t.Parallel() bp := ` sdk { name: "mysdk", @@ -352,6 +355,7 @@ func TestSnapshot_EnvConfiguration(t *testing.T) { } t.Run("no env variables", func(t *testing.T) { + t.Parallel() result := preparer.RunTest(t) checkZipFile(t, result, "out/soong/.intermediates/mysdk/common_os/mysdk-current.zip") @@ -377,6 +381,7 @@ java_import { }) t.Run("SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE=S", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForSdkTestWithJava, java.PrepareForTestWithJavaDefaultModules, @@ -468,6 +473,7 @@ java_sdk_library_import { }) t.Run("test replacing exportable module", func(t *testing.T) { + t.Parallel() result := android.GroupFixturePreparers( prepareForSdkTestWithJava, java.PrepareForTestWithJavaDefaultModules, -- cgit v1.2.3-59-g8ed1b