Skip to content

Commit

Permalink
Fix race in test
Browse files Browse the repository at this point in the history
==================
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
==================
  • Loading branch information
arp242 committed May 1, 2024
1 parent f830802 commit 61ccd0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fsevents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ func TestIssue48(t *testing.T) {
filenames = append(filenames, newFilename)

// create an all-new instances to avoid problems
es = &EventStream{
es2 := &EventStream{
Paths: filenames,
Latency: 500 * time.Millisecond,
Device: 0, //dev,
Flags: FileEvents,
}

err = es.Start()
err = es2.Start()
if err == nil {
es.Stop()
es2.Stop()
t.Fatal("eventstream error was not detected on >4096 files in watchlist")
}
}
Expand Down

0 comments on commit 61ccd0a

Please sign in to comment.