Skip to content

Commit

Permalink
fs/asyncreader: skip some tests to work around race detector bug
Browse files Browse the repository at this point in the history
The race detector currently detects a race with len(chan) against
close(chan).

See: golang/go#27070

Skip the tests which trip this bug under the race detector.
  • Loading branch information
ncw committed Aug 20, 2018
1 parent 7780649 commit 7712a0e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/asyncreader/asyncreader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"testing/iotest"
"time"

"github.com/ncw/rclone/lib/israce"
"github.com/ncw/rclone/lib/readers"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -303,6 +304,9 @@ func TestAsyncReaderSkipBytes(t *testing.T) {
8000, len(data), BufferSize, 2 * BufferSize}

for buffers := 1; buffers <= 5; buffers++ {
if israce.Enabled && buffers > 1 {
t.Skip("FIXME Skipping further tests with race detector until https://github.com/golang/go/issues/27070 is fixed.")
}
t.Run(fmt.Sprintf("%d", buffers), func(t *testing.T) {
for _, initialRead := range initialReads {
t.Run(fmt.Sprintf("%d", initialRead), func(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions lib/israce/israce.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build race

// Package israce reports if the Go race detector is enabled.
//
// From https://stackoverflow.com/questions/44944959/how-can-i-check-if-the-race-detector-is-enabled-at-runtime
package israce

// Enabled reports if the race detector is enabled.
const Enabled = true
9 changes: 9 additions & 0 deletions lib/israce/norace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build !race

// Package israce reports if the Go race detector is enabled.
//
// From https://stackoverflow.com/questions/44944959/how-can-i-check-if-the-race-detector-is-enabled-at-runtime
package israce

// Enabled reports if the race detector is enabled.
const Enabled = false

0 comments on commit 7712a0e

Please sign in to comment.