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
diff --git a/apex/aconfig_test.go b/apex/aconfig_test.go
index bb811f5..2ab61b3 100644
--- a/apex/aconfig_test.go
+++ b/apex/aconfig_test.go
@@ -33,6 +33,7 @@
})
func TestValidationAcrossContainersExportedPass(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
bp string
@@ -294,6 +295,7 @@
}
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
+ t.Parallel()
android.GroupFixturePreparers(
java.PrepareForTestWithJavaDefaultModules,
cc.PrepareForTestWithCcBuildComponents,
@@ -309,6 +311,7 @@
}
func TestValidationAcrossContainersNotExportedFail(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
expectedError string
@@ -709,6 +712,7 @@
}
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
+ t.Parallel()
errorHandler := android.FixtureExpectsNoErrors
if test.expectedError != "" {
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(test.expectedError)
@@ -730,6 +734,7 @@
}
func TestValidationNotPropagateAcrossShared(t *testing.T) {
+ t.Parallel()
testCases := []struct {
name string
bp string
@@ -786,6 +791,7 @@
}
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
+ t.Parallel()
android.GroupFixturePreparers(
java.PrepareForTestWithJavaDefaultModules,
cc.PrepareForTestWithCcBuildComponents,