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

testing: testing a list of packages blocks the real-time output #27826

Open
mwf opened this issue Sep 24, 2018 · 3 comments
Open

testing: testing a list of packages blocks the real-time output #27826

mwf opened this issue Sep 24, 2018 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@mwf
Copy link

mwf commented Sep 24, 2018

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

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes, reproduced on tip - go version devel +ce58a39fca Thu Sep 20 22:52:44 2018 +0000 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ikorolev/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ikorolev/.gvm/pkgsets/go1.11/global:/Users/ikorolev/dev/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/ikorolev/.gvm/gos/go1.11"
GOTMPDIR=""
GOTOOLDIR="/Users/ikorolev/.gvm/gos/go1.11/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_b/d1934m9s587_8t_6ngv3hnc00000gp/T/go-build880489854=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go test -v -count=1 ./... doesn't print real-time test output if you got subpackages.

cd `mktemp -d`
go mod init example.com/test
cat <<EOD > main_test.go
package main

import (
	"fmt"
	"testing"
	"time"
)

func TestLong(t *testing.T) {
	fmt.Println("running")
	time.Sleep(2 * time.Second)
	fmt.Println("2 second later")
}
EOD
mkdir subpkg
cat <<EOD > subpkg/main_test.go
package subpkg
EOD
go test -v -count=1 ./...

What did you expect to see?

I expect to see the output successively as the test is running.
And I will see it if run go test -v -count=1 . instead.

What did you see instead?

Using ./... doesn't produce real-time output.
The output is produced only when all the tests are finished.

It's not convenient when you run tests on a CI and see only "go test -v ./..." line for several minutes.
You don't have any idea if the tests have stuck somewhere or they are just too slow.

I understand that such behaviour may be connected with running the tests in parallel, but maybe we could do anything about it?

@mwf
Copy link
Author

mwf commented Sep 24, 2018

@gopherbot please, add label Testing.

@gopherbot gopherbot added the Testing An issue that has been verified to require only test changes, not just a test failure. label Sep 24, 2018
@ianlancetaylor
Copy link
Contributor

Related to #24929.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 24, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Sep 24, 2018
@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@paol
Copy link

paol commented Aug 1, 2019

A flag to disable stdout buffering could be helpful. Or, at a minimum, document the effect of the -p (and -count ?) flags on output buffering.

As a note, this bug is not quite a duplicate of #24929, as it affects all of stdout, not just the uses of t.Log (Maybe the underlying mechanism is the same, I don't know.)

We care about stdout too because we're doing heavy initializations in TestMain where t.Log isn't available, and we want to see the progress messages as they happen.

@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
wjam added a commit to RedisLabs/terraform-provider-rediscloud that referenced this issue May 18, 2023
Go will only stream test logs if it is testing a single module at a
time, otherwise it will buffer the logs to the end and then display
them. This causes issues for CI as it means there's no idea what is
happening at the moment and the logs will be missing if the run is
cancelled.

See golang/go#27826.
wjam added a commit to RedisLabs/terraform-provider-rediscloud that referenced this issue May 18, 2023
* Add port, remote backup & CIDRs support

Add support for:
* Specifying the port number on a normal or active/active database
* Configuring backups for normal or active/active databases
* Specifying multiple CIDR ranges when peering a normal or active/active
database

* Run all acceptance tests in parallel

* Stream `go test` logs

Go will only stream test logs if it is testing a single module at a
time, otherwise it will buffer the logs to the end and then display
them. This causes issues for CI as it means there's no idea what is
happening at the moment and the logs will be missing if the run is
cancelled.

See golang/go#27826.

* Run all acceptance tests in parallel

CI is taking far too long and needs to be sped up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

6 participants