Fix data races in finder_test.go
Fix data races by incrementing clock before starting the finder. Fixes: ================== WARNING: DATA RACE Read at 0x00c0003be1c0 by goroutine 99: android/soong/finder/fs.(*MockFs).WriteFile() build/soong/finder/fs/fs.go:159 +0x869 android/soong/finder.(*Finder).dumpDb() build/soong/finder/finder.go:1163 +0x296 android/soong/finder.(*Finder).goDumpDb.func1() build/soong/finder/finder.go:337 +0x3c Previous write at 0x00c0003be1c0 by goroutine 43: android/soong/finder.TestDirectoryNotPermitted() build/soong/finder/fs/fs.go:155 +0x49a testing.tRunner() prebuilts/go/linux-x86/src/testing/testing.go:865 +0x163 Goroutine 99 (running) created at: android/soong/finder.(*Finder).goDumpDb() build/soong/finder/finder.go:336 +0x8d android/soong/finder.(*Finder).loadFromFilesystem() build/soong/finder/finder.go:380 +0x12b android/soong/finder.newImpl() build/soong/finder/finder.go:197 +0x38d android/soong/finder.newFinderAndErr() build/soong/finder/finder_test.go:58 +0x245 android/soong/finder.newFinderWithNumThreads() build/soong/finder/finder_test.go:42 +0xb3 android/soong/finder.TestDirectoryNotPermitted() build/soong/finder/finder_test.go:38 +0x386 testing.tRunner() prebuilts/go/linux-x86/src/testing/testing.go:865 +0x163 Goroutine 43 (running) created at: testing.(*T).Run() prebuilts/go/linux-x86/src/testing/testing.go:916 +0x65a testing.runTests.func1() prebuilts/go/linux-x86/src/testing/testing.go:1157 +0xa8 testing.tRunner() prebuilts/go/linux-x86/src/testing/testing.go:865 +0x163 testing.runTests() prebuilts/go/linux-x86/src/testing/testing.go:1155 +0x523 testing.(*M).Run() prebuilts/go/linux-x86/src/testing/testing.go:1072 +0x2eb main.main() out/soong/.bootstrap/soong-finder/test/test.go:157 +0x1dc ================== Test: run finder_test.go with race detector enabled Change-Id: Ia77090dabaf8b14a80ac9ce938fef75f1d382574
Loading
Please register or sign in to comment