Bazel: More verbose test failure output

Created on 14 May 2015  Â·  7Comments  Â·  Source: bazelbuild/bazel

Is there a way to get more verbose test output?

When I run bazel test

➜  libkubernetes git:(master)# bazel test //test                              
INFO: Found 1 test target...
FAIL: //test:test (see /home/miked/.cache/bazel/_bazel_miked/f4f1511ac3aadf22b22f6857b29e43da/libkubernetes/bazel-out/local_linux-fastbuild/testlogs/test/test/test.log).
Target //test:test up-to-date:
  bazel-bin/test/test
INFO: Elapsed time: 0.235s, Critical Path: 0.01s
//test:test                                                              FAILED

Executed 1 out of 1 tests: 1 fails locally.

This output is not very useful to me. When I run the test binary directly I get more useful test output:

➜  libkubernetes git:(master)# ./bazel-out/local_linux-fastbuild/bin/test/test
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MyTest
[ RUN      ] MyTest.thing
test/unit/my_test.cc:4: Failure
Value of: 2
Expected: 1
[  FAILED  ] MyTest.thing (0 ms)
[----------] 1 test from MyTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] MyTest.thing

 1 FAILED TEST

For reference, I am testing in this repo https://github.com/mikedanese/libkubernetes

Most helpful comment

I answer my self:

bazel test --test_output=errors --action_env="GTEST_COLOR=1" ...

All 7 comments

Have you tried --test_output=errors? (Same result as cat-ing the test log
file whose location is printed using the default settings.)

On Thu, May 14, 2015 at 12:16 PM, Mike Danese [email protected]
wrote:

Is there a way to get more verbose test failure output?
When I run bazel test

➜ libkubernetes git:(master) ✗ bazel test //test
INFO: Found 1 test target...
FAIL: //test:test (see /home/miked/.cache/bazel/_bazel_miked/f4f1511ac3aadf22b22f6857b29e43da/libkubernetes/bazel-out/local_linux-fastbuild/testlogs/test/test/test.log).
Target //test:test up-to-date:
bazel-bin/test/test
INFO: Elapsed time: 0.235s, Critical Path: 0.01s
//test:test FAILED

Executed 1 out of 1 tests: 1 fails locally.

This output is not very useful to me. When I run the test binary directly
I get more useful test output:

➜ libkubernetes git:(master) ✗ ./bazel-out/local_linux-fastbuild/bin/test/test
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MyTest
[ RUN ] MyTest.thing
test/unit/my_test.cc:4: Failure
Value of: 2
Expected: 1
[ FAILED ] MyTest.thing (0 ms)
[----------] 1 test from MyTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] MyTest.thing

1 FAILED TEST

For reference, I am testing in this repo
https://github.com/mikedanese/libkubernetes

—
Reply to this email directly or view it on GitHub
https://github.com/google/bazel/issues/190.

Awesome! Exactly what I was looking for. Thanks!

Adding this to the docs/tutorial somewhere would be fantastic.

is there a way to make this the default (config, env)?

@apelisse in your .bazelrc you can add

test --test_output=errors

e.g. here: https://github.com/kubernetes/kubernetes/blob/master/.bazelrc#L3

Any way to get colors on the output?

I answer my self:

bazel test --test_output=errors --action_env="GTEST_COLOR=1" ...

Was this page helpful?
0 / 5 - 0 ratings