diff options
author | 2020-09-18 14:25:31 -0700 | |
---|---|---|
committer | 2020-10-06 15:12:22 -0700 | |
commit | 323dc60712491c71ccdc5363c42df61f0a192487 (patch) | |
tree | 5ba86007fb0f7d2536671cbc64e91b1eac304270 /android/util_test.go | |
parent | 56a8321c210bf73c7b9f177849ff4a6b6192d237 (diff) |
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
Diffstat (limited to 'android/util_test.go')
-rw-r--r-- | android/util_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/android/util_test.go b/android/util_test.go index 25b52ca03..8c421577e 100644 --- a/android/util_test.go +++ b/android/util_test.go @@ -60,6 +60,7 @@ var firstUniqueStringsTestCases = []struct { } func TestFirstUniqueStrings(t *testing.T) { + t.Parallel() f := func(t *testing.T, imp func([]string) []string, in, want []string) { t.Helper() out := imp(in) @@ -120,6 +121,7 @@ var lastUniqueStringsTestCases = []struct { } func TestLastUniqueStrings(t *testing.T) { + t.Parallel() for _, testCase := range lastUniqueStringsTestCases { out := LastUniqueStrings(testCase.in) if !reflect.DeepEqual(out, testCase.out) { @@ -132,6 +134,7 @@ func TestLastUniqueStrings(t *testing.T) { } func TestJoinWithPrefix(t *testing.T) { + t.Parallel() testcases := []struct { name string input []string @@ -171,6 +174,7 @@ func TestJoinWithPrefix(t *testing.T) { } func TestIndexList(t *testing.T) { + t.Parallel() input := []string{"a", "b", "c"} testcases := []struct { @@ -210,6 +214,7 @@ func TestIndexList(t *testing.T) { } func TestInList(t *testing.T) { + t.Parallel() input := []string{"a"} testcases := []struct { @@ -241,6 +246,7 @@ func TestInList(t *testing.T) { } func TestPrefixInList(t *testing.T) { + t.Parallel() prefixes := []string{"a", "b"} testcases := []struct { @@ -276,6 +282,7 @@ func TestPrefixInList(t *testing.T) { } func TestFilterList(t *testing.T) { + t.Parallel() input := []string{"a", "b", "c", "c", "b", "d", "a"} filter := []string{"a", "c"} remainder, filtered := FilterList(input, filter) @@ -300,6 +307,7 @@ func TestFilterList(t *testing.T) { } func TestRemoveListFromList(t *testing.T) { + t.Parallel() input := []string{"a", "b", "c", "d", "a", "c", "d"} filter := []string{"a", "c"} expected := []string{"b", "d", "d"} @@ -314,6 +322,7 @@ func TestRemoveListFromList(t *testing.T) { } func TestRemoveFromList(t *testing.T) { + t.Parallel() testcases := []struct { name string key string @@ -417,6 +426,7 @@ func ExampleCopyOf_append() { } func TestSplitFileExt(t *testing.T) { + t.Parallel() t.Run("soname with version", func(t *testing.T) { root, suffix, ext := SplitFileExt("libtest.so.1.0.30") expected := "libtest" @@ -482,6 +492,7 @@ func TestSplitFileExt(t *testing.T) { } func Test_Shard(t *testing.T) { + t.Parallel() type args struct { strings []string shardSize int |