Skip to content
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

go test broken with parameters #33869

Closed
marcopeereboom opened this issue Aug 27, 2019 · 4 comments
Closed

go test broken with parameters #33869

marcopeereboom opened this issue Aug 27, 2019 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@marcopeereboom
Copy link

It looks like go test fails if any parameters are passed to it.

For example:

$ go test ./...
flag provided but not defined: -test.testlogfile
Usage of /var/folders/g0/pp3c88hj5k50_zsc55c3wnb00000gn/T/go-build565133450/b001/dcrd.test:
FAIL    github.com/decred/dcrd  0.048s
...
$ go test -v . 
flag provided but not defined: -test.testlogfile
Usage of /var/folders/g0/pp3c88hj5k50_zsc55c3wnb00000gn/T/go-build782636389/b001/dcrd.test:
FAIL    github.com/decred/dcrd  0.046s
FAIL

What version of Go are you using (go version)?

$ go version
go version go1.13rc1 darwin/amd64

and

$ go version
go version devel +1a423be Tue Aug 27 01:12:00 2019 +0000 openbsd/amd64

Does this issue reproduce with the latest release?

It works fine with 1.12

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/marco/Library/Caches/go-build"
GOENV="/Users/marco/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/marco/Documents/gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/marco/Documents/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/marco/Documents/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/marco/Documents/gopath/src/github.com/decred/dcrd/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/g0/pp3c88hj5k50_zsc55c3wnb00000gn/T/go-build489241021=/tmp/go-build -gno-record-gcc-switches -fno-common"

and

$ gotip env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jrick/.cache/go-build"
GOENV="/home/jrick/.config/go/env"
GOEXE=""
GOFLAGS="-tags=netgo -ldflags=-extldflags=-static"
GOHOSTARCH="amd64"
GOHOSTOS="openbsd"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/home/jrick/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jrick/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jrick/sdk/gotip/pkg/tool/openbsd_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"

What did you do?

go test -v

What did you expect to see?

Tests running.

What did you see instead?

$ go test -v 
flag provided but not defined: -test.v
Usage of /var/folders/g0/pp3c88hj5k50_zsc55c3wnb00000gn/T/go-build958647978/b001/dcrd.test:
exit status 2
FAIL    github.com/decred/dcrd  0.279s
@marcopeereboom
Copy link
Author

I just noticed that this is a duplicate of #33774 however I'd like to point out that this works on some platforms (windows) and not on others (darwin/openbsd). This inconsistent behavior between platforms will cause all kinds of headaches for people working on multiplatform code. Can all platforms at least fail the same way so that when a repo is migrated to 1.13 at least the tests will fail everywhere the same?

@bcmills
Copy link
Contributor

bcmills commented Aug 27, 2019

this works on some platforms (windows) and not on others (darwin/openbsd)

It should fail on all platforms: the underlying problem is due to init functions calling flag.Parse before the testing flags have been registered, and to my knowledge the testing init and registration order is the same across platforms.

@bcmills
Copy link
Contributor

bcmills commented Aug 27, 2019

This is likely a duplicate of #31859, but it would be helpful to get more detail on the cross-platform aspect.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 27, 2019
@jrick
Copy link
Contributor

jrick commented Aug 27, 2019

Ignore the part about windows. Our developer on windows was not testing in the same directory.

This can be closed as a duplicate.

jbpratt added a commit to MemeLabs/modbot that referenced this issue Jun 6, 2020
jbpratt added a commit to MemeLabs/modbot that referenced this issue Jun 6, 2020
@golang golang locked and limited conversation to collaborators Aug 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants