diff --git a/Makefile b/Makefile index 9ac927d..6591b24 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ default: test test: *.go - go test -v ./... + go test -v -race ./... fmt: gofmt -w . diff --git a/tail_test.go b/tail_test.go index 3beba4f..6d602a4 100644 --- a/tail_test.go +++ b/tail_test.go @@ -25,6 +25,13 @@ func init() { } } +func TestMain(m *testing.M) { + // Use a smaller poll duration for faster test runs. Keep it below + // 100ms (which value is used as common delays for tests) + watch.POLL_DURATION = 5 * time.Millisecond + os.Exit(m.Run()) +} + func TestMustExist(t *testing.T) { tail, err := TailFile("/no/such/file", Config{Follow: true, MustExist: true}) if err == nil { @@ -387,10 +394,6 @@ func NewTailTest(name string, t *testing.T) TailTest { tt.Fatal(err) } - // Use a smaller poll duration for faster test runs. Keep it below - // 100ms (which value is used as common delays for tests) - watch.POLL_DURATION = 5 * time.Millisecond - return tt }