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

x/tools/cmd/godoc: TestWebIndex test fails with timeout #24504

Closed
ysmolsky opened this issue Mar 23, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@ysmolsky
Copy link
Member

commented Mar 23, 2018

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

tip

Does this issue reproduce with the latest release?

yes, x/tools tip

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/thornLibrary/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/thorn/go"
GORACE=""
GOROOT="/Users/thorn/golang"
GOTMPDIR=""
GOTOOLDIR="/Users/thorn/golang/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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/km/50gy6_q557v6_7vxbf9b29v00000gn/T/go-build042238440=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

...tools/cmd/godoc (master $=) % go test -v
=== RUN   TestCLI
--- PASS: TestCLI (1.45s)
=== RUN   TestWeb
--- PASS: TestWeb (2.34s)
=== RUN   TestWebIndex
--- FAIL: TestWebIndex (121.72s)
	godoc_test.go:202: Server failed to respond in 2m0s
=== RUN   TestTypeAnalysis
--- PASS: TestTypeAnalysis (2.41s)
FAIL
exit status 1
FAIL	golang.org/x/tools/cmd/godoc	127.950s

Indexing takes too much time on my machine. Running this test with hacked
args = append(args, "-index", "-index_interval=-1s", "-v") gives:

...tools/cmd/godoc (master *$=) % go test -test.run TestWebIndex
2018/03/23 13:03:48 Go Documentation Server
2018/03/23 13:03:48 version = devel +2767c4e285 Fri Mar 16 21:01:28 2018 +0000
2018/03/23 13:03:48 address = 127.0.0.1:64324
2018/03/23 13:03:48 goroot = /Users/thorn/golang
2018/03/23 13:03:48 tabwidth = 4
2018/03/23 13:03:48 full text index enabled (maxresults = 10000)
name space {
	/:
		gated(os(/Users/thorn/golang), 20) /
	/lib/godoc:
		mapfs /
	/src:
		gated(os(/Users/thorn/golang), 20) /src
		gated(os(/Users/thorn/go), 20) /src
}

Testing of cmd/godoc should not depend on the local tree of sources in GOPATH.

@gopherbot gopherbot added this to the Unreleased milestone Mar 23, 2018

@ysmolsky

This comment has been minimized.

Copy link
Member Author

commented Mar 23, 2018

The test expects that unsetting GOPATH for godoc (godocEnv function) would work, so that godoc would not include GOPATH. But it is not true:

...tools/cmd/godoc (master *$=) % GOPATH= godoc -http=:6060 -v
2018/03/23 13:19:04 Go Documentation Server
2018/03/23 13:19:04 version = devel +2767c4e285 Fri Mar 16 21:01:28 2018 +0000
2018/03/23 13:19:04 address = :6060
2018/03/23 13:19:04 goroot = /Users/thorn/golang
2018/03/23 13:19:04 tabwidth = 4
2018/03/23 13:19:04 search index disabled
name space {
	/:
		gated(os(/Users/thorn/golang), 20) /
	/lib/godoc:
		mapfs /
	/src:
		gated(os(/Users/thorn/golang), 20) /src
		gated(os(/Users/thorn/go), 20) /src
}

It happens b/c godoc uses build.Default.GOPATH which returns default GOPATH set to ~/go if GOPATH was not set in env:

	for _, p := range filepath.SplitList(build.Default.GOPATH) {
		fs.Bind("/src", gatefs.New(vfs.OS(p), fsGate), "/src", vfs.BindAfter)
	}

@mvdan mvdan added the Testing label Mar 23, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Mar 23, 2018

Change https://golang.org/cl/102295 mentions this issue: cmd/godoc: fixed TestWebIndex test

@gopherbot

This comment has been minimized.

Copy link

commented Mar 27, 2018

Change https://golang.org/cl/102796 mentions this issue: [release-branch.go1.10] cmd/godoc: fix TestWebIndex test

gopherbot pushed a commit to golang/tools that referenced this issue Mar 28, 2018

[release-branch.go1.10] cmd/godoc: fix TestWebIndex test
The godoc in the test was indexing sources in the default GOPATH.
If the default GOPATH pointed to local workspace, test would timeout.
The fix is to supply GOPATH set to non-existing path.

Fixes golang/go#24504

Change-Id: Iedf044cdec78d5c5642105650ad8ec17aa10a5ba
Reviewed-on: https://go-review.googlesource.com/102295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 77106db)
Reviewed-on: https://go-review.googlesource.com/102796
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>

@golang golang locked and limited conversation to collaborators Mar 27, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.