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

cmd/go: unavailable vcs fails test #26837

Closed
iWdGo opened this issue Aug 7, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@iWdGo
Copy link
Contributor

@iWdGo iWdGo commented Aug 7, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11beta3 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\()\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\()\Documents\Google\
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\()\AppData\Local\Temp\go-build152074326=/tmp/go-build -gno-record-gcc-switches

What did you do?

c:\Users\()\Documents\Google\golang\go\src>go test -run=TestMove -v cmd/go

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

c:\Users\Costa\Documents\Google\golang\go\src>go test -run=TestMove -v cmd/go
=== RUN   TestMoveGit
=== PAUSE TestMoveGit
=== RUN   TestMoveHG
=== PAUSE TestMoveHG
=== CONT  TestMoveGit
=== CONT  TestMoveHG
--- SKIP: TestMoveHG (1.39s)
--- PASS: TestMoveGit (34.37s)
    (same test output)
PASS
PASS    cmd/go  46.407s

What did you see instead?

c:\Users\Costa\Documents\Google\golang\go\src>go test -run=TestMove -v cmd/go
=== RUN   TestMoveGit
=== PAUSE TestMoveGit
=== RUN   TestMoveHG
=== PAUSE TestMoveHG
=== CONT  TestMoveGit
=== CONT  TestMoveHG
--- FAIL: TestMoveHG (7.39s)
    go_test.go:1079: running testgo [get -d vcs-test.golang.org/go/custom-hg-hello]
    go_test.go:1079: standard error:
    go_test.go:1079: go: missing Mercurial command. See https://golang.org/s/gogetcmd
        package vcs-test.golang.org/go/custom-hg-hello: exec: "hg": executable file not found in %PATH%

    go_test.go:1079: go [get -d vcs-test.golang.org/go/custom-hg-hello] failed unexpectedly in C:\Go\src\cmd\go: exit status 1
--- PASS: TestMoveGit (34.37s)
    go_test.go:1079: running testgo [get -d rsc.io/pdf]
    go_test.go:1080: running testgo [get -d -u rsc.io/pdf]
    go_test.go:1102: running testgo [build -o sink.exe sink]
    go_test.go:1105: running testgo [get -d -u rsc.io/pdf]
    go_test.go:1105: standard error:
    go_test.go:1105: package rsc.io/pdf: rsc.io/pdf is a custom import path for https://github.com/rsc/pdf, but C:\Users\Costa\AppData\Local\Temp\gotest245418038\src\rsc.io\pdf is checked out from https://github.com/rsc/pdfXXX

    go_test.go:1105: testgo failed as expected: exit status 1
    go_test.go:1107: running testgo [get -d -f -u rsc.io/pdf]
    go_test.go:1107: standard error:
    go_test.go:1107: # cd C:\Users\Costa\AppData\Local\Temp\gotest245418038\src\rsc.io\pdf; git pull --ff-only
        remote: Repository not found.
        fatal: repository 'https://github.com/rsc/pdfXXX/' not found
        package rsc.io/pdf: exit status 1

    go_test.go:1107: testgo failed as expected: exit status 1
FAIL
FAIL    cmd/go  46.407s

The test fails as one vcs (Mercurial in the example) is unavailable. Test should be skipped with the usual warning when vcs is unavailable. As a side remark, cmd/go tests are timing out after 10 minutes. As tests run in parallel as 'PAUSED" until all tests are listed as per output above, such errors never appear in short mode.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 7, 2018

Change https://golang.org/cl/128195 mentions this issue: cmd/go: skip test when vcs is unavailable

@bcmills bcmills added the NeedsFix label Aug 9, 2018
@bcmills bcmills added this to the Go1.11 milestone Aug 9, 2018
@bcmills bcmills added the Testing label Aug 9, 2018
@rsc rsc modified the milestones: Go1.11, Go1.12 Aug 10, 2018
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Nov 15, 2018

Assigned to @iWdGo, since a fix is pending in https://golang.org/cl/128195.

@iWdGo

This comment has been minimized.

Copy link
Contributor Author

@iWdGo iWdGo commented Nov 19, 2019

Issue can be closed as https://golang.org/cl/207700 moved relevant tests to scripts which include do not fail when VCS command is unavailable.

$GOPATH\golang\go\src>hg
'hg' is not recognized as an internal or external command,
operable program or batch file.

$GOPATH\golang\go\src>gotip version
go version devel +17c78e23f9 Tue Nov 19 19:51:37 2019 +0100 windows/amd64

$GOPATH\golang\go\src>gotip test cmd/go -v -run=Script/gopath_moved_repo
=== RUN   TestScript
=== RUN   TestScript/gopath_moved_repo
=== PAUSE TestScript/gopath_moved_repo
=== CONT  TestScript/gopath_moved_repo
go test proxy running at GOPROXY=http://127.0.0.1:54737/mod
    TestScript/gopath_moved_repo: script_test.go:192:
        WORK=$WORK
        PATH=******
        USERPROFILE=/no-home
        CCACHE_DISABLE=1
        GOARCH=amd64
        GOCACHE=$USER_PROFILE\AppData\Local\go-build
        GOEXE=.exe
        GOOS=windows
        GOPATH=$WORK\gopath
        GOPROXY=http://127.0.0.1:54737/mod
        GOPRIVATE=
        GOROOT=$GOPATH\golang\go
        GOSUMDB=localhost.localdev/sumdb+00000c67+AcTrnkbUA+TU4heY3hkjiSES/DSQniBqIeQ/YppAUtK6
        GONOPROXY=
        GONOSUMDB=
        PWD=$WORK\gopath\src
        TMP=$WORK\tmp
        devnull=NUL
        goversion=1.14
        :=;
        SYSTEMROOT=C:\WINDOWS
        WINDIR=C:\WINDOWS

        > env GO111MODULE=off
        # Test that 'go get -u' reports packages whose VCS configurations do not
        # match their import paths. (0.000s)
        > [!net] skip
        > [short] skip
        # We need to execute a custom Go program to break the config files.
        #
        # git will ask for a username and password when we run 'go get -d -f -u',
        # so we also need to set GIT_ASKPASS. Conveniently, a single binary can
        # perform both tasks! (1.168s)
        > go build -o replace.exe replace
        > env GIT_ASKPASS=$PWD/replace.exe
        # Test that 'go get -u' reports moved git packages. (25.701s)
        > [exec:git] go get -d rsc.io/pdf
        > [exec:git] go get -d -u rsc.io/pdf
        > [exec:git] exec ./replace.exe pdf rsc.io/pdf/.git/config
        > [exec:git] ! go get -d -u rsc.io/pdf
        [stderr]
        package rsc.io/pdf: rsc.io/pdf is a custom import path for https://github.com/rsc/pdf, but $WORK\gopath\src\rsc.io\pdf is checked out from https://github.com/rsc/pdfXXX
        [exit status 1]
        > [exec:git] stderr 'is a custom import path for'
        > [exec:git] ! go get -d -f -u rsc.io/pdf
        [stderr]
        # cd $WORK\gopath\src\rsc.io\pdf; git pull --ff-only
        remote: Repository not found.
        fatal: repository 'https://github.com/rsc/pdfXXX/' not found
        package rsc.io/pdf: exit status 1
        [exit status 1]
        > [exec:git] stderr 'validating server certificate|[nN]ot [fF]ound'
        # Test that 'go get -u' reports moved Mercurial packages. (0.043s)
        > [exec:hg] go get -d vcs-test.golang.org/go/custom-hg-hello
        > [exec:hg] go get -d -u vcs-test.golang.org/go/custom-hg-hello
        > [exec:hg] exec ./replace.exe custom-hg-hello vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc
        > [exec:hg] ! go get -d -u vcs-test.golang.org/go/custom-hg-hello
        > [exec:hg] stderr 'is a custom import path for'
        > [exec:hg] ! go get -d -f -u vcs-test.golang.org/go/custom-hg-hello
        > [exec:hg] stderr 'validating server certificate|[nN]ot [fF]ound'
        PASS

--- PASS: TestScript (0.01s)
    --- PASS: TestScript/gopath_moved_repo (27.44s)
PASS
ok      cmd/go  41.100s

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Nov 19, 2019

Thanks for pointing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.