From 609471461652c3ac7b9faac3bba2f14ec84b4782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ronny=20L=C3=B3pez?= Date: Sat, 23 Jan 2016 10:54:36 +0100 Subject: [PATCH] Run tests with -race --- .travis.yml | 2 ++ logrus_test.go | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.travis.yml b/.travis.yml index ec64114..ff23150 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: go go: - 1.3 - 1.4 + - 1.5 - tip install: - go get -t ./... +script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./... diff --git a/logrus_test.go b/logrus_test.go index efaacea..b7d9302 100644 --- a/logrus_test.go +++ b/logrus_test.go @@ -299,3 +299,18 @@ func TestGetSetLevelRace(t *testing.T) { } wg.Wait() } + +func TestLoggingRace(t *testing.T) { + logger := New() + + var wg sync.WaitGroup + wg.Add(100) + + for i := 0; i < 100; i++ { + go func() { + logger.Info("info") + wg.Done() + }() + } + wg.Wait() +}