Skip to content

Commit 61ccd0a

Browse files
committed
Fix race in test
================== WARNING: DATA RACE Write at 0x00c000394018 by goroutine 10: github.com/fsnotify/fsevents.TestIssue48() /Users/runner/work/fsevents/fsevents/fsevents_test.go:137 +0xcc6 testing.tRunner() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1259 +0x22f testing.(*T).Run·dwrap·21() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1306 +0x47 Previous read at 0x00c000394018 by goroutine 12: github.com/fsnotify/fsevents.TestIssue48.func1() /Users/runner/work/fsevents/fsevents/fsevents_test.go:112 +0x1d2 Goroutine 10 (running) created at: testing.(*T).Run() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1306 +0x726 testing.runTests.func1() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1598 +0x99 testing.tRunner() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1259 +0x22f testing.runTests() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1596 +0x7ca testing.(*M).Run() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1504 +0x9d1 main.main() _testmain.go:55 +0x22b Goroutine 12 (finished) created at: github.com/fsnotify/fsevents.TestIssue48() /Users/runner/work/fsevents/fsevents/fsevents_test.go:107 +0x815 testing.tRunner() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1259 +0x22f testing.(*T).Run·dwrap·21() /Users/runner/hostedtoolcache/go/1.17.13/x64/src/testing/testing.go:1306 +0x47 ==================
1 parent f830802 commit 61ccd0a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fsevents_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,16 @@ func TestIssue48(t *testing.T) {
134134
filenames = append(filenames, newFilename)
135135

136136
// create an all-new instances to avoid problems
137-
es = &EventStream{
137+
es2 := &EventStream{
138138
Paths: filenames,
139139
Latency: 500 * time.Millisecond,
140140
Device: 0, //dev,
141141
Flags: FileEvents,
142142
}
143143

144-
err = es.Start()
144+
err = es2.Start()
145145
if err == nil {
146-
es.Stop()
146+
es2.Stop()
147147
t.Fatal("eventstream error was not detected on >4096 files in watchlist")
148148
}
149149
}

0 commit comments

Comments
 (0)