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/rust/binary_test.go b/rust/binary_test.go
index b44a5bc..692a066 100644
--- a/rust/binary_test.go
+++ b/rust/binary_test.go
@@ -23,6 +23,7 @@
 
 // Test that rustlibs default linkage is correct for binaries.
 func TestBinaryLinkage(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary {
 			name: "fizz-buzz",
@@ -86,6 +87,7 @@
 
 // Test that the path returned by HostToolPath is correct
 func TestHostToolPath(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary_host {
 			name: "fizz-buzz",
@@ -100,6 +102,7 @@
 
 // Test that the flags being passed to rust_binary modules are as expected
 func TestBinaryFlags(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary_host {
 			name: "fizz-buzz",
@@ -143,6 +146,7 @@
 }
 
 func TestLinkObjects(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary {
 			name: "fizz-buzz",
@@ -162,6 +166,7 @@
 
 // Test that stripped versions are correctly generated and used.
 func TestStrippedBinary(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary {
 			name: "foo",
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go
index 9cccf13..7ff996d 100644
--- a/rust/bindgen_test.go
+++ b/rust/bindgen_test.go
@@ -20,6 +20,7 @@
 )
 
 func TestRustBindgen(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_bindgen {
 			name: "libbindgen",
@@ -66,6 +67,7 @@
 }
 
 func TestRustBindgenCustomBindgen(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_bindgen {
 			name: "libbindgen",
diff --git a/rust/builder_test.go b/rust/builder_test.go
index 5c11cb7..cda03a9 100644
--- a/rust/builder_test.go
+++ b/rust/builder_test.go
@@ -17,6 +17,7 @@
 import "testing"
 
 func TestSourceProviderCollision(t *testing.T) {
+	t.Parallel()
 	testRustError(t, "multiple source providers generate the same filename output: bindings.rs", `
 		rust_binary {
 			name: "source_collider",
diff --git a/rust/clippy_test.go b/rust/clippy_test.go
index 7815aab..786dc15 100644
--- a/rust/clippy_test.go
+++ b/rust/clippy_test.go
@@ -21,6 +21,7 @@
 )
 
 func TestClippy(t *testing.T) {
+	t.Parallel()
 
 	bp := `
 		// foo uses the default value of clippy_lints
diff --git a/rust/compiler_test.go b/rust/compiler_test.go
index a25523c..70f0dff 100644
--- a/rust/compiler_test.go
+++ b/rust/compiler_test.go
@@ -23,6 +23,7 @@
 
 // Test that feature flags are being correctly generated.
 func TestFeaturesToFlags(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library_host_dylib {
 			name: "libfoo",
@@ -44,6 +45,7 @@
 
 // Test that we reject multiple source files.
 func TestEnforceSingleSourceFile(t *testing.T) {
+	t.Parallel()
 
 	singleSrcError := "srcs can only contain one path for a rust file and source providers prefixed by \":\""
 
@@ -78,6 +80,7 @@
 }
 
 func TestInstallDir(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library_dylib {
 			name: "libfoo",
@@ -108,6 +111,7 @@
 }
 
 func TestLints(t *testing.T) {
+	t.Parallel()
 
 	bp := `
 		// foo uses the default value of lints
@@ -180,6 +184,7 @@
 
 // Test that devices are linking the stdlib dynamically
 func TestStdDeviceLinkage(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary {
 			name: "fizz",
diff --git a/rust/coverage_test.go b/rust/coverage_test.go
index 90155ca..ced548d 100644
--- a/rust/coverage_test.go
+++ b/rust/coverage_test.go
@@ -23,6 +23,7 @@
 
 // Test that coverage flags are being correctly generated.
 func TestCoverageFlags(t *testing.T) {
+	t.Parallel()
 	ctx := testRustCov(t, `
 		rust_library {
 			name: "libfoo_cov",
@@ -98,6 +99,7 @@
 
 // Test coverage files are included correctly
 func TestCoverageZip(t *testing.T) {
+	t.Parallel()
 	ctx := testRustCov(t, `
 		rust_library {
 			name: "libfoo",
@@ -174,6 +176,7 @@
 }
 
 func TestCoverageDeps(t *testing.T) {
+	t.Parallel()
 	ctx := testRustCov(t, `
 		rust_binary {
 			name: "fizz",
diff --git a/rust/library_test.go b/rust/library_test.go
index fec3992..fdab78d 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -23,6 +23,7 @@
 
 // Test that variants are being generated correctly, and that crate-types are correct.
 func TestLibraryVariants(t *testing.T) {
+	t.Parallel()
 
 	ctx := testRust(t, `
 		rust_library_host {
@@ -71,6 +72,7 @@
 
 // Test that dylibs are not statically linking the standard library.
 func TestDylibPreferDynamic(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library_host_dylib {
 			name: "libfoo",
@@ -86,6 +88,7 @@
 }
 
 func TestValidateLibraryStem(t *testing.T) {
+	t.Parallel()
 	testRustError(t, "crate_name must be defined.", `
 			rust_library_host {
 				name: "libfoo",
@@ -123,6 +126,7 @@
 }
 
 func TestSharedLibrary(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_ffi_shared {
 			name: "libfoo",
@@ -145,6 +149,7 @@
 }
 
 func TestStaticLibraryLinkage(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_ffi_static {
 			name: "libfoo",
@@ -162,6 +167,7 @@
 
 // Test that variants pull in the right type of rustlib autodep
 func TestAutoDeps(t *testing.T) {
+	t.Parallel()
 
 	ctx := testRust(t, `
                 rust_library_host {
@@ -209,6 +215,7 @@
 
 // Test that stripped versions are correctly generated and used.
 func TestStrippedLibrary(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library_dylib {
 			name: "libfoo",
@@ -240,6 +247,7 @@
 }
 
 func TestLibstdLinkage(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library {
 			name: "libfoo",
diff --git a/rust/protobuf_test.go b/rust/protobuf_test.go
index bd11a5a..cfe56a3 100644
--- a/rust/protobuf_test.go
+++ b/rust/protobuf_test.go
@@ -20,6 +20,7 @@
 )
 
 func TestRustProtobuf(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_protobuf {
 			name: "librust_proto",
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 4842a4c..26e943a 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -135,6 +135,7 @@
 
 // Test that we can extract the link path from a lib path.
 func TestLinkPathFromFilePath(t *testing.T) {
+	t.Parallel()
 	barPath := android.PathForTesting("out/soong/.intermediates/external/libbar/libbar/linux_glibc_x86_64_shared/libbar.so")
 	libName := linkPathFromFilePath(barPath)
 	expectedResult := "out/soong/.intermediates/external/libbar/libbar/linux_glibc_x86_64_shared/"
@@ -146,6 +147,7 @@
 
 // Test to make sure dependencies are being picked up correctly.
 func TestDepsTracking(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_ffi_host_static {
 			name: "libstatic",
@@ -207,6 +209,7 @@
 }
 
 func TestSourceProviderDeps(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary {
 			name: "fizz-buzz-dep",
@@ -294,6 +297,7 @@
 }
 
 func TestSourceProviderTargetMismatch(t *testing.T) {
+	t.Parallel()
 	// This might error while building the dependency tree or when calling depsToPaths() depending on the lunched
 	// target, which results in two different errors. So don't check the error, just confirm there is one.
 	testRustError(t, ".*", `
@@ -316,6 +320,7 @@
 
 // Test to make sure proc_macros use host variants when building device modules.
 func TestProcMacroDeviceDeps(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library_host_rlib {
 			name: "libbar",
@@ -343,6 +348,7 @@
 
 // Test that no_stdlibs suppresses dependencies on rust standard libraries
 func TestNoStdlibs(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_binary {
 			name: "fizz-buzz",
@@ -358,6 +364,7 @@
 
 // Test that libraries provide both 32-bit and 64-bit variants.
 func TestMultilib(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_library_rlib {
 			name: "libfoo",
diff --git a/rust/source_provider_test.go b/rust/source_provider_test.go
index 6e68ae6..f16d694 100644
--- a/rust/source_provider_test.go
+++ b/rust/source_provider_test.go
@@ -21,6 +21,7 @@
 var stemRequiredError = "source_stem property is undefined but required for rust_bindgen modules"
 
 func TestSourceProviderRequiredFields(t *testing.T) {
+	t.Parallel()
 	testRustError(t, stemRequiredError, `
 		rust_bindgen {
 			name: "libbindgen",
diff --git a/rust/test_test.go b/rust/test_test.go
index fea2ad0..bb4695a 100644
--- a/rust/test_test.go
+++ b/rust/test_test.go
@@ -22,6 +22,7 @@
 )
 
 func TestRustTest(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_test_host {
 			name: "my_test",
@@ -37,6 +38,7 @@
 }
 
 func TestRustTestLinkage(t *testing.T) {
+	t.Parallel()
 	ctx := testRust(t, `
 		rust_test {
 			name: "my_test",