bazel-contrib / bazel-contrib/rules_go

unclear how to consistently get all of the log output from tests

Open
#4,158 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

### What version of rules_go are you using?

0.50.1

### What version of gazelle are you using?

0.39.1

### What version of Bazel are you using?

7.3.1

### Does this issue reproduce with the latest releases of all the above?

Yes.

### What operating system and processor architecture are you using?

macOS arm

### What did you do?

Tried to run all of the tests in a package without caching with verbosity turned up to see all of the `t.Logf` lines in it.

I tried both with `-test.v`, and `test.count` and without:

```
$ bazel test --cache_test_results=no --test_output=all //foobar/baz:baz_test
```

```
$ bazel test --cache_test_results=no --test_output=all --test_arg="-test.v" //foobar/baz:baz_test
```

```
$ bazel test --cache_test_results=no --test_output=all --test_arg="-test.count=1" //foobar/baz:baz_test
```

```
$ bazel test --cache_test_results=no --test_output=all --test_arg="-test.count=1" --test_arg="-test.v" //foobar/baz:baz_test
```

### What did you expect to see?
All of the tests enumerated and all the log lines run by the tests like the usual `go test -v` command.

Output like:

```
$ go test -v .
=== RUN TestGoldenPath
baz_test.go:23: I'm here
```

### What did you see instead?

The versions with `-test.v` or `-test.count` always just print (with `--cache_test_results=no --test_output=all` included, of course) will only get you the

```
//foobar/baz:baz_test PASSED in 1.0s
```

Dropping those and only run `bazel test --cache_test_results=no --test_output=all` will get you only:

```
==================== Test output for //foobar/baz:baz_test:
PASS
================================================================================
```

with the usual

```
//foobar/baz:baz_test PASSED in 1.0s
```
after it

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported commands for //foobar/baz:baz_test, comparing Bazel's output with `go test -v .`; the example points to baz_test.go:23. Check how `t.Logf` output is handled under `--test_output=all`, `-test.v`, and `-test.count=1`. Done means the documented command consistently shows all test names and log lines without relying on caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.