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
diff --git a/sdk/bp_test.go b/sdk/bp_test.go
index e1edc51..4cd54c7 100644
--- a/sdk/bp_test.go
+++ b/sdk/bp_test.go
@@ -180,6 +180,7 @@
 }
 
 func TestTransformRemoveProperty(t *testing.T) {
+	t.Parallel()
 
 	helper := &TestHelper{t}
 
@@ -195,6 +196,7 @@
 }
 
 func TestTransformRemovePropertySet(t *testing.T) {
+	t.Parallel()
 
 	helper := &TestHelper{t}
 
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index c214e75..e0cba09 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -40,6 +40,7 @@
 // Contains tests for SDK members provided by the cc package.
 
 func TestSingleDeviceOsAssumption(t *testing.T) {
+	t.Parallel()
 	// Mock a module with DeviceSupported() == true.
 	s := &sdk{}
 	android.InitAndroidArchModule(s, android.DeviceSupported, android.MultilibCommon)
@@ -54,6 +55,7 @@
 }
 
 func TestSdkIsCompileMultilibBoth(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -84,6 +86,7 @@
 }
 
 func TestSdkCompileMultilibOverride(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -175,6 +178,7 @@
 }
 
 func TestBasicSdkWithCc(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -281,6 +285,7 @@
 
 // Make sure the sdk can use host specific cc libraries static/shared and both.
 func TestHostSdkWithCc(t *testing.T) {
+	t.Parallel()
 	testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -304,6 +309,7 @@
 
 // Make sure the sdk can use cc libraries static/shared and both.
 func TestSdkWithCc(t *testing.T) {
+	t.Parallel()
 	testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -334,6 +340,7 @@
 }
 
 func TestSnapshotWithObject(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -405,6 +412,7 @@
 }
 
 func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -446,6 +454,7 @@
 // handling is tested with the sanitize clauses (but note there's a lot of
 // built-in logic in sanitize.go that can affect those flags).
 func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -559,6 +568,7 @@
 }
 
 func TestSnapshotWithCcBinary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "mymodule_exports",
@@ -623,6 +633,7 @@
 }
 
 func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "myexports",
@@ -749,6 +760,7 @@
 }
 
 func TestSnapshotWithSingleHostOsType(t *testing.T) {
+	t.Parallel()
 	ctx, config := testSdkContext(`
 		cc_defaults {
 			name: "mydefaults",
@@ -912,6 +924,7 @@
 // Test that we support the necessary flags for the linker binary, which is
 // special in several ways.
 func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "mymodule_exports",
@@ -1014,6 +1027,7 @@
 }
 
 func TestSnapshotWithCcSharedLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -1107,6 +1121,7 @@
 }
 
 func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -1301,6 +1316,7 @@
 }
 
 func TestHostSnapshotWithCcSharedLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -1418,6 +1434,7 @@
 }
 
 func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -1543,6 +1560,7 @@
 }
 
 func TestSnapshotWithCcStaticLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "myexports",
@@ -1627,6 +1645,7 @@
 }
 
 func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "myexports",
@@ -1741,6 +1760,7 @@
 }
 
 func TestSnapshotWithCcLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "myexports",
@@ -1838,6 +1858,7 @@
 }
 
 func TestHostSnapshotWithMultiLib64(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		module_exports {
 			name: "myexports",
@@ -1945,6 +1966,7 @@
 }
 
 func TestSnapshotWithCcHeadersLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -1993,6 +2015,7 @@
 }
 
 func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -2075,6 +2098,7 @@
 }
 
 func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -2170,6 +2194,7 @@
 }
 
 func TestSystemSharedLibPropagation(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -2407,6 +2432,7 @@
 }
 
 func TestStubsLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -2485,6 +2511,7 @@
 }
 
 func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
@@ -2601,6 +2628,7 @@
 }
 
 func TestUniqueHostSoname(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithCc(t, `
 		sdk {
 			name: "mysdk",
diff --git a/sdk/exports_test.go b/sdk/exports_test.go
index aa1200f..173ccb9 100644
--- a/sdk/exports_test.go
+++ b/sdk/exports_test.go
@@ -20,6 +20,7 @@
 
 // Ensure that module_exports generates a module_exports_snapshot module.
 func TestModuleExportsSnapshot(t *testing.T) {
+	t.Parallel()
 	packageBp := `
 		module_exports {
 			name: "myexports",
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index d6828c9..f86ab57 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -92,6 +92,7 @@
 // Contains tests for SDK members provided by the java package.
 
 func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -141,6 +142,7 @@
 }
 
 func TestBasicSdkWithJavaLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -220,6 +222,7 @@
 }
 
 func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -272,6 +275,7 @@
 }
 
 func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -332,6 +336,7 @@
 }
 
 func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -398,6 +403,7 @@
 }
 
 func TestSnapshotWithJavaImplLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		module_exports {
 			name: "myexports",
@@ -451,6 +457,7 @@
 }
 
 func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		module_exports {
 			name: "myexports",
@@ -511,6 +518,7 @@
 }
 
 func TestSnapshotWithJavaTest(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		module_exports {
 			name: "myexports",
@@ -561,6 +569,7 @@
 }
 
 func TestHostSnapshotWithJavaTest(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		module_exports {
 			name: "myexports",
@@ -633,6 +642,7 @@
 // directly or indirectly from an APEX as droidstubs can never be a part of an
 // apex.
 func TestBasicSdkWithDroidstubs(t *testing.T) {
+	t.Parallel()
 	testSdkWithDroidstubs(t, `
 		sdk {
 				name: "mysdk",
@@ -663,6 +673,7 @@
 }
 
 func TestSnapshotWithDroidstubs(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithDroidstubs(t, `
 		module_exports {
 			name: "myexports",
@@ -708,6 +719,7 @@
 }
 
 func TestHostSnapshotWithDroidstubs(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithDroidstubs(t, `
 		module_exports {
 			name: "myexports",
@@ -762,6 +774,7 @@
 }
 
 func TestSnapshotWithJavaSystemModules(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -856,6 +869,7 @@
 }
 
 func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -934,6 +948,7 @@
 }
 
 func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		module_exports {
 			name: "myexports",
@@ -1061,6 +1076,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -1165,6 +1181,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -1229,6 +1246,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -1296,6 +1314,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -1386,6 +1405,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -1497,6 +1517,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
@@ -1587,6 +1608,7 @@
 }
 
 func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
+	t.Parallel()
 	result := testSdkWithJava(t, `
 		sdk {
 			name: "mysdk",
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index 2e6c62a..a6afdc5 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -35,6 +35,7 @@
 }
 
 func TestDepNotInRequiredSdks(t *testing.T) {
+	t.Parallel()
 	testSdkError(t, `module "myjavalib".*depends on "otherlib".*that isn't part of the required SDKs:.*`, `
 		sdk {
 			name: "mysdk",
@@ -95,6 +96,7 @@
 // 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"],
@@ -302,6 +304,7 @@
 }
 
 func TestSDkInstall(t *testing.T) {
+	t.Parallel()
 	sdk := `
 		sdk {
 			name: "mysdk",
@@ -346,6 +349,7 @@
 var _ propertiesContainer = (*testPropertiesStruct)(nil)
 
 func TestCommonValueOptimization(t *testing.T) {
+	t.Parallel()
 	common := &testPropertiesStruct{name: "common"}
 	structs := []propertiesContainer{
 		&testPropertiesStruct{
@@ -443,6 +447,7 @@
 }
 
 func TestCommonValueOptimization_InvalidArchSpecificVariants(t *testing.T) {
+	t.Parallel()
 	common := &testPropertiesStruct{name: "common"}
 	structs := []propertiesContainer{
 		&testPropertiesStruct{