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/finder/finder_test.go b/finder/finder_test.go
index 88b0c05..029c80f 100644
--- a/finder/finder_test.go
+++ b/finder/finder_test.go
@@ -122,6 +122,7 @@
 // end of utils, start of individual tests
 
 func TestSingleFile(t *testing.T) {
+	t.Parallel()
 	runSimpleTest(t,
 		[]string{"findme.txt"},
 		[]string{"findme.txt"},
@@ -129,6 +130,7 @@
 }
 
 func TestIncludeFiles(t *testing.T) {
+	t.Parallel()
 	runSimpleTest(t,
 		[]string{"findme.txt", "skipme.txt"},
 		[]string{"findme.txt"},
@@ -136,6 +138,7 @@
 }
 
 func TestNestedDirectories(t *testing.T) {
+	t.Parallel()
 	runSimpleTest(t,
 		[]string{"findme.txt", "skipme.txt", "subdir/findme.txt", "subdir/skipme.txt"},
 		[]string{"findme.txt", "subdir/findme.txt"},
@@ -143,6 +146,7 @@
 }
 
 func TestEmptyDirectory(t *testing.T) {
+	t.Parallel()
 	runSimpleTest(t,
 		[]string{},
 		[]string{},
@@ -150,6 +154,7 @@
 }
 
 func TestEmptyPath(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	root := "/tmp"
 	fs.Create(t, filepath.Join(root, "findme.txt"), filesystem)
@@ -170,6 +175,7 @@
 }
 
 func TestFilesystemRoot(t *testing.T) {
+	t.Parallel()
 
 	testWithNumThreads := func(t *testing.T, numThreads int) {
 		filesystem := newFs()
@@ -197,6 +203,7 @@
 }
 
 func TestNonexistentDir(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
 
@@ -215,6 +222,7 @@
 }
 
 func TestExcludeDirs(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	fs.Create(t, "/tmp/exclude/findme.txt", filesystem)
 	fs.Create(t, "/tmp/exclude/subdir/findme.txt", filesystem)
@@ -243,6 +251,7 @@
 }
 
 func TestPruneFiles(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	fs.Create(t, "/tmp/out/findme.txt", filesystem)
 	fs.Create(t, "/tmp/out/.ignore-out-dir", filesystem)
@@ -275,6 +284,7 @@
 // TestRootDir tests that the value of RootDirs is used
 // tests of the filesystem root are in TestFilesystemRoot
 func TestRootDir(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/findme.txt", filesystem)
 	fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
@@ -299,6 +309,7 @@
 }
 
 func TestUncachedDir(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/findme.txt", filesystem)
 	fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
@@ -326,6 +337,7 @@
 }
 
 func TestSearchingForFilesExcludedFromCache(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -353,6 +365,7 @@
 }
 
 func TestRelativeFilePaths(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 
 	fs.Create(t, "/tmp/ignore/hi.txt", filesystem)
@@ -397,6 +410,7 @@
 // have to run this test with the race-detector (`go test -race src/android/soong/finder/*.go`)
 // for there to be much chance of the test actually detecting any error that may be present
 func TestRootDirsContainedInOtherRootDirs(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 
 	fs.Create(t, "/tmp/a/b/c/d/e/f/g/h/i/j/findme.txt", filesystem)
@@ -418,6 +432,7 @@
 }
 
 func TestFindFirst(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/hi.txt", filesystem)
 	fs.Create(t, "/tmp/b/hi.txt", filesystem)
@@ -442,6 +457,7 @@
 }
 
 func TestConcurrentFindSameDirectory(t *testing.T) {
+	t.Parallel()
 
 	testWithNumThreads := func(t *testing.T, numThreads int) {
 		filesystem := newFs()
@@ -493,6 +509,7 @@
 }
 
 func TestConcurrentFindDifferentDirectories(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 
 	// create a bunch of files and directories
@@ -556,6 +573,7 @@
 }
 
 func TestStrangelyFormattedPaths(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -581,6 +599,7 @@
 }
 
 func TestCorruptedCacheHeader(t *testing.T) {
+	t.Parallel()
 	filesystem := newFs()
 
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -605,6 +624,7 @@
 }
 
 func TestCanUseCache(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -651,6 +671,7 @@
 }
 
 func TestCorruptedCacheBody(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -715,6 +736,7 @@
 }
 
 func TestStatCalls(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/findme.txt", filesystem)
@@ -738,6 +760,7 @@
 }
 
 func TestFileAdded(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/ignoreme.txt", filesystem)
@@ -780,6 +803,7 @@
 }
 
 func TestDirectoriesAdded(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/ignoreme.txt", filesystem)
@@ -824,6 +848,7 @@
 }
 
 func TestDirectoryAndSubdirectoryBothUpdated(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/hi1.txt", filesystem)
@@ -864,6 +889,7 @@
 }
 
 func TestFileDeleted(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/ignoreme.txt", filesystem)
@@ -904,6 +930,7 @@
 }
 
 func TestDirectoriesDeleted(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -959,6 +986,7 @@
 }
 
 func TestDirectoriesMoved(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -1017,6 +1045,7 @@
 }
 
 func TestDirectoriesSwapped(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -1132,6 +1161,7 @@
 }
 
 func TestChangeOfDevice(t *testing.T) {
+	t.Parallel()
 	fs1 := newFs()
 	// not as fine-grained mounting controls as a real filesystem, but should be adequate
 	fs1.SetDeviceNumber(0)
@@ -1143,6 +1173,7 @@
 }
 
 func TestChangeOfUserOrHost(t *testing.T) {
+	t.Parallel()
 	fs1 := newFs()
 	fs1.SetViewId("me@here")
 
@@ -1153,6 +1184,7 @@
 }
 
 func TestConsistentCacheOrdering(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	for i := 0; i < 5; i++ {
@@ -1205,6 +1237,7 @@
 }
 
 func TestNumSyscallsOfSecondFind(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -1235,6 +1268,7 @@
 }
 
 func TestChangingParamsOfSecondFind(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/findme.txt", filesystem)
@@ -1265,6 +1299,7 @@
 }
 
 func TestSymlinkPointingToFile(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/hi.txt", filesystem)
@@ -1301,6 +1336,7 @@
 }
 
 func TestSymlinkPointingToDirectory(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/dir/hi.txt", filesystem)
@@ -1335,6 +1371,7 @@
 // TestAddPruneFile confirms that adding a prune-file (into a directory for which we
 // already had a cache) causes the directory to be ignored
 func TestAddPruneFile(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/out/hi.txt", filesystem)
@@ -1373,6 +1410,7 @@
 }
 
 func TestUpdatingDbIffChanged(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/hi.txt", filesystem)
@@ -1432,6 +1470,7 @@
 }
 
 func TestDirectoryNotPermitted(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/hi.txt", filesystem)
@@ -1480,6 +1519,7 @@
 }
 
 func TestFileNotPermitted(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/hi.txt", filesystem)
@@ -1502,6 +1542,7 @@
 }
 
 func TestCacheEntryPathUnexpectedError(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := newFs()
 	fs.Create(t, "/tmp/a/hi.txt", filesystem)
diff --git a/finder/fs/fs_test.go b/finder/fs/fs_test.go
index 22a4d7a..5671bcf 100644
--- a/finder/fs/fs_test.go
+++ b/finder/fs/fs_test.go
@@ -20,6 +20,7 @@
 )
 
 func TestMockFs_LstatStatSymlinks(t *testing.T) {
+	t.Parallel()
 	// setup filesystem
 	filesystem := NewMockFs(nil)
 	Create(t, "/tmp/realdir/hi.txt", filesystem)
diff --git a/finder/fs/readdir_test.go b/finder/fs/readdir_test.go
index 24a6d18..d133bba 100644
--- a/finder/fs/readdir_test.go
+++ b/finder/fs/readdir_test.go
@@ -22,6 +22,7 @@
 )
 
 func TestParseDirent(t *testing.T) {
+	t.Parallel()
 	testCases := []struct {
 		name string
 		in   []byte