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/cmd/diff_target_files/allow_list_test.go b/cmd/diff_target_files/allow_list_test.go
index 8410e5a..9f89657 100644
--- a/cmd/diff_target_files/allow_list_test.go
+++ b/cmd/diff_target_files/allow_list_test.go
@@ -58,6 +58,7 @@
var f2 = bytesToZipArtifactFile("dir/f2", nil)
func Test_applyAllowLists(t *testing.T) {
+ t.Parallel()
type args struct {
diff zipDiff
allowLists []allowList
diff --git a/cmd/diff_target_files/compare_test.go b/cmd/diff_target_files/compare_test.go
index 9d3f8a5..7621246 100644
--- a/cmd/diff_target_files/compare_test.go
+++ b/cmd/diff_target_files/compare_test.go
@@ -21,6 +21,7 @@
)
func TestDiffTargetFilesLists(t *testing.T) {
+ t.Parallel()
zipArtifactFile := func(name string, crc32 uint32, size uint64) *ZipArtifactFile {
return &ZipArtifactFile{
File: &zip.File{
diff --git a/cmd/diff_target_files/glob_test.go b/cmd/diff_target_files/glob_test.go
index 63df68d..f2c6c6a 100644
--- a/cmd/diff_target_files/glob_test.go
+++ b/cmd/diff_target_files/glob_test.go
@@ -19,6 +19,7 @@
)
func TestMatch(t *testing.T) {
+ t.Parallel()
testCases := []struct {
pattern, name string
match bool
diff --git a/cmd/extract_apks/main_test.go b/cmd/extract_apks/main_test.go
index c3e6a2d..40f3882 100644
--- a/cmd/extract_apks/main_test.go
+++ b/cmd/extract_apks/main_test.go
@@ -37,6 +37,7 @@
}
func TestSelectApks_ApkSet(t *testing.T) {
+ t.Parallel()
testCases := []testDesc{
{
protoText: `
@@ -266,6 +267,7 @@
}
func TestSelectApks_ApexSet(t *testing.T) {
+ t.Parallel()
testCases := []testDesc{
{
protoText: `
@@ -442,6 +444,7 @@
}
func TestWriteApks(t *testing.T) {
+ t.Parallel()
testCases := []testCaseWriteApks{
{
name: "splits",
diff --git a/cmd/extract_linker/main_test.go b/cmd/extract_linker/main_test.go
index 6ac4ec6..4e1ed02 100644
--- a/cmd/extract_linker/main_test.go
+++ b/cmd/extract_linker/main_test.go
@@ -51,6 +51,7 @@
}
func TestBytesToAsm(t *testing.T) {
+ t.Parallel()
for _, testcase := range bytesToAsmTestCases {
t.Run(testcase.name, func(t *testing.T) {
buf := bytes.Buffer{}
diff --git a/cmd/host_bionic_inject/host_bionic_inject_test.go b/cmd/host_bionic_inject/host_bionic_inject_test.go
index b415b34..ef5120b 100644
--- a/cmd/host_bionic_inject/host_bionic_inject_test.go
+++ b/cmd/host_bionic_inject/host_bionic_inject_test.go
@@ -100,6 +100,7 @@
}
func TestCheckLinker(t *testing.T) {
+ t.Parallel()
cases := []struct {
name string
err error
diff --git a/cmd/javac_wrapper/javac_wrapper_test.go b/cmd/javac_wrapper/javac_wrapper_test.go
index ad23001..a1812fb 100644
--- a/cmd/javac_wrapper/javac_wrapper_test.go
+++ b/cmd/javac_wrapper/javac_wrapper_test.go
@@ -93,6 +93,7 @@
}
func TestJavacColorize(t *testing.T) {
+ t.Parallel()
for i, test := range testCases {
t.Run(strconv.Itoa(i), func(t *testing.T) {
buf := new(bytes.Buffer)
@@ -110,6 +111,7 @@
}
func TestSubprocess(t *testing.T) {
+ t.Parallel()
t.Run("failure", func(t *testing.T) {
exitCode, err := Main(ioutil.Discard, "test", []string{"sh", "-c", "exit 9"})
if err != nil {
diff --git a/cmd/merge_zips/merge_zips_test.go b/cmd/merge_zips/merge_zips_test.go
index cb58436..78ffb76 100644
--- a/cmd/merge_zips/merge_zips_test.go
+++ b/cmd/merge_zips/merge_zips_test.go
@@ -85,6 +85,7 @@
}
func TestMergeZips(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
in [][]testZipEntry
@@ -361,6 +362,7 @@
}
func TestInputZipsManager(t *testing.T) {
+ t.Parallel()
const nInputZips = 20
const nMaxOpenZips = 10
izm := NewInputZipsManager(20, 10)
diff --git a/cmd/multiproduct_kati/main_test.go b/cmd/multiproduct_kati/main_test.go
index 263a124..e3ddfd7 100644
--- a/cmd/multiproduct_kati/main_test.go
+++ b/cmd/multiproduct_kati/main_test.go
@@ -21,6 +21,7 @@
)
func TestSplitList(t *testing.T) {
+ t.Parallel()
testcases := []struct {
inputCount int
shardCount int
diff --git a/cmd/path_interposer/main_test.go b/cmd/path_interposer/main_test.go
index c89d623..3f1a5e1 100644
--- a/cmd/path_interposer/main_test.go
+++ b/cmd/path_interposer/main_test.go
@@ -61,6 +61,7 @@
}
func TestInterposer(t *testing.T) {
+ t.Parallel()
interposer := setup(t)
logConfig := func(name string) paths.PathConfig {
@@ -180,6 +181,7 @@
}
func TestMissingPath(t *testing.T) {
+ t.Parallel()
interposer := setup(t)
err := os.Remove(interposer + "_origpath")
if err != nil {
diff --git a/cmd/soong_build/bazel_overlay_test.go b/cmd/soong_build/bazel_overlay_test.go
index f0c8515..ceb342f 100644
--- a/cmd/soong_build/bazel_overlay_test.go
+++ b/cmd/soong_build/bazel_overlay_test.go
@@ -64,6 +64,7 @@
}
func TestGenerateBazelOverlayFromBlueprint(t *testing.T) {
+ t.Parallel()
testCases := []struct {
bp string
expectedBazelTarget string
diff --git a/cmd/zip2zip/zip2zip_test.go b/cmd/zip2zip/zip2zip_test.go
index 2c4e005..e6ac0bf 100644
--- a/cmd/zip2zip/zip2zip_test.go
+++ b/cmd/zip2zip/zip2zip_test.go
@@ -416,6 +416,7 @@
}
func TestZip2Zip(t *testing.T) {
+ t.Parallel()
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
inputBuf := &bytes.Buffer{}
@@ -472,6 +473,7 @@
}
func TestConstantPartOfPattern(t *testing.T) {
+ t.Parallel()
testCases := []struct{ in, out string }{
{
in: "",