Enable race detection on test run, fix race condition#232
Conversation
Signed-off-by: Robert Lin <robertlin1@gmail.com>
Signed-off-by: Robert Lin <robertlin1@gmail.com>
| - golint -set_exit_status $(go list ./... | grep -v /vendor/) | ||
| - flake8 | ||
| - go test -coverpkg=all -v -coverprofile=coverage.txt -covermode=count gopkg.in/src-d/hercules.v9/... && sed -i '/cmd\/hercules\|core.go/d' coverage.txt | ||
| - go test -race gopkg.in/src-d/hercules.v9/... # run race test separately to preserve -covermode=count |
There was a problem hiding this comment.
note on this: it appears -race must be run with -covermode=atomic:
❯ go test -race -coverpkg=all -v -coverprofile=coverage.txt -covermode=count gopkg.in/src-d/hercules.v9/... && sed -i '/cmd\/hercules\|core.go/d' coverage.txt
-covermode must be "atomic", not "count", when -race is enabled
It's not great having the test suite run twice though, so I'm holding off on updating the appveyor config for now, but imo having the race detection is much more valuable than -covermode=count, let me know what you think and I can swap it over entirely to -covermode=atomic.
There was a problem hiding this comment.
I am fine with -covermode=atomic as long as it does not break the profile stats, so yeah, let's swap.
…aces Signed-off-by: Robert Lin <robertlin1@gmail.com>
|
Not sure what happened with one of the build jobs: https://travis-ci.com/src-d/hercules/jobs/183188633 but the |
|
Hi @bobheadxi thanks so much for your contribution. That build failed because of an annoying problem in Travis environment related to networking: I restarted that job. I have recently had to restart it 5 times before that error goes away, which is very annoying. We are thinking with @smola what can be done to resolve it. |
|
It is 10pm here, so I will review this tomorrow 👍 |
| - golint -set_exit_status $(go list ./... | grep -v /vendor/) | ||
| - flake8 | ||
| - go test -coverpkg=all -v -coverprofile=coverage.txt -covermode=count gopkg.in/src-d/hercules.v9/... && sed -i '/cmd\/hercules\|core.go/d' coverage.txt | ||
| - go test -race gopkg.in/src-d/hercules.v9/... # run race test separately to preserve -covermode=count |
There was a problem hiding this comment.
I am fine with -covermode=atomic as long as it does not break the profile stats, so yeah, let's swap.
Enable race detection on test run, fix race condition
Enable race detection on test run, fix race condition
Please feel free to close this if avoiding race conditions aren't a priority, but I noticed my
-race-enabled tests would fail on what seemed like hercules code.If the build for this PR fails (it does locally on my machine) I'll open a ticket about resolving concurrency issues.
Here's what I get when I run hercules' tests on my machine:
update: travis ran into the same issue, so I've opened #233 with some more details
update 2: working on resolving race conditions, so hopefully this will close #233 as well