-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: 'go test --race' needs gcc for main packages on windows #27089
Comments
It's true that the race detector requires GCC to be available. There is no workaround at present. |
@ianlancetaylor Maybe the answer to this is "No", it doesn't reproduce with Specifically this prevents |
@dvyukov Any advice? |
If you |
If this works with go 1.10, I think we need to figure out what change broke this and why. Perhaps somebody on Go team knows? Or otherwise bisect. |
The workaround is to set I tested the data race detection in the same environment with relevant env:
The flag to be tested is As far as I remember, gcc is not installed on my laptop. It is maybe available because of Google Cloud SDK which includes Python but I doubt so as I cannot reach it any way that I tried. The documentation https://golang.org/doc/articles/race_detector.html#Supported_Systems does not mention a prerequisite for Windows. I ran the race detector on the example adapted for go test: https://play.golang.org/p/ZTZcFHchMiI
The results are (GOPATH in place of its value):
(edited for formatting) |
@judwhite that is not what I see here with go 1.10.4
Alex |
I've been using the race detector in CI for quite a while, this is the first Go version (1.10.4 and 1.11) where this issue has been encountered. I'll use the |
@judwhite as you can see from my previous message, my experience is different. So, if you want me to investigate this, you have to provide more details. I need step by step instructions of how to reproduce this. Please, assume, I have brand new Windows computer with nothing installed on it. Thank you. Alex |
This issue seems to have commonalities with others that I have. There is maybe a slight difference of behavior between Windows 10 Pro and Windows 10 Home (my version). For instance, |
Because of golang/go#27089, passing "-race" to ginkgo causes the windows build to fail. We are simply removing this flag until the golang issue is resolved. (Units on other operating systems still check for race conditions.) [#160911621] Signed-off-by: Will Murphy <[email protected]>
Because of golang/go#27089, passing "-race" to ginkgo causes the windows build to fail. We are simply removing this flag until the golang issue is resolved. (Units on other operating systems still check for race conditions.) This change is to parallel fe63a26. [#160911621]
I made a minimal, self-contained example: https://github.com/femot/race-no-gcc
Results in output:
This is true, I do not have But we can "fix" it:
Let us try without a
Works just fine! I am willing to try out things and provide additional information, if required. |
@femot I agree, But, according to @judwhite, go1.10 does not requires gcc. I need steps that demonstrate go1.10 does not requires gcc. Do you know how to reproduce that? Thank you. Alex |
Just tested it with 1.10 and 1.10.8 on a relatively fresh Windows 10 VM (no Go or other compilers/programming environments previously installed).
This is the behaviour I expected/am used to: being able to |
Your example doesn't have any tests. I suspect your Alex |
As demonstrated previously, no tests are required to reproduce this behaviour with Go 1.11. This means I updated Go on the machine where I did the tests with 1.10 and 1.10.8 and ran the commands again:
There were no other changes to any files, installed programs, or the system. To me it looks like the This is why the example I provided contains no tests files. The existence of test files makes no difference and is not needed to trigger this behaviour. |
That is not what I see here
Alex |
Ok this is weird. I have two different installations here that are able to reproduce it. I also tried 1.12beta2 after seeing that you tested on devel. Can you post the output of In my team of 4 people, one had gcc installed, one installed gcc, because of this and I just confirmed with the last one that he also has the same behaviour:
|
Alex |
I'm out of ideas. The only thing that looks different is that you tried it on devel, so I tried it on 1.12rc1 to see if it was fixed between 1.11 and 1.12, but it still reproduced.
|
Because of golang/go#27089, we need to disable go vet support in go test on Windows. It's a handy tool, though, so we should leave it enabled on Linux so it runs on the build machines, etc.
Because of golang/go#27089, we need to disable go vet support in go test on Windows. It's a handy tool, though, so we should leave it enabled on Linux so it runs on the build machines, etc.
found the same issue on using -race flag works in a package different than
|
I think I'm seeing this problem when you have a test in the top level package. In our case we generate no-op test stubs for packages without tests, so they appear in coverage reports. Though this only happens on our CI instances (on CircleCI), and not on my Mac desktop. It's very strange. |
Scratch that, I just tried it without the generated test. |
This reverts commit 8b3aae1. This is due to GCC being required by `go test -race`. See also golang/go#27089
Because of golang/go#27089, passing "-race" to ginkgo causes the windows build to fail. We are simply removing this flag until the golang issue is resolved. (Units on other operating systems still check for race conditions.) [#160911621] Signed-off-by: Will Murphy <[email protected]>
Because of golang/go#27089, passing "-race" to ginkgo causes the windows build to fail. We are simply removing this flag until the golang issue is resolved. (Units on other operating systems still check for race conditions.) This change is to parallel fe63a26. [#160911621]
Hi! Just as an increment of this issue (probably you people have already know this), but the very same problem happens when running I'm using both Docker and Docker Compose in a Linux Mint 20 Cinnamon machine. The project structure:
The contents of version: "3.7"
services:
build:
image: golang:1.16-alpine
volumes:
- .:/code
working_dir: /code
environment:
- CGO_ENABLED=1
command: go build -race -o /code/bin/bof ./cmd
test:
image: golang:1.16-alpine
volumes:
- .:/code
working_dir: /code
environment:
- CGO_ENABLED=1
command: go test -race ./... The contents of package main
import "fmt"
func main() {
fmt.Println("EITA")
} And the output of
The output when running the commands:
EDIT: There was a typo on the declaration of GOARCH. I've used only CGO_ENABLED as env var, and the results haven't changed. |
Experienced same problem with go1.17 / Windows 10 and E2E tests all located within main package:
Trick with
|
What version of Go are you using (
go version
)?go version go1.11rc1 windows/amd64
Does this issue reproduce with the latest release?
go 1.11rc1
go 1.10.3
What operating system and processor architecture are you using (
go env
)?What did you do?
It doesn't happen for non-main packages:
--race
by itself is sufficient to repro, you don't need to set the CPU count or disable caching.What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: