Bazel always exits 0

226 views
Skip to first unread message

macrae...@gmail.com

unread,
Sep 29, 2017, 1:47:08 PM9/29/17
to bazel-discuss
I'm not sure if this is due to me recently upgrading or if this has just been true forever, but right now on test or build failures my bazel is returning 0. This makes it so that CI is not doing it's job. Is this a bug? Is there a flag I should be passing? I'm very surprised by this.

$ bazel version
Build label: 0.5.4
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Aug 25 10:00:00 2017 (1503655200)
Build timestamp: 1503655200
Build timestamp as int: 1503655200


$ bazel test //keyservice/pkg/keystore:keystore-tests
Loading:
Loading: 0 packages loaded
Analyzing: target //keyservice/pkg/keystore:keystore-tests (8 packages loaded)
INFO: Analysed target //keyservice/pkg/keystore:keystore-tests (11 packages loaded).
INFO: Found 1 test target...
[0 / 5] BazelWorkspaceStatusAction stable-status.txt
FAIL: //keyservice/pkg/keystore:keystore-tests (see /root/.cache/bazel/_bazel_root/cf3077b83e930e0c42e53cc2f9959c4d/execroot/cc_gyroscope/bazel-out/local-fastbuild/testlogs/keyservice/pkg/keystore/keystore-tests/test.log)
Target //keyservice/pkg/keystore:keystore-tests up-to-date:
bazel-bin/keyservice/pkg/keystore/keystore-tests
INFO: Elapsed time: 5.951s, Critical Path: 0.14s
INFO: Build completed, 1 test FAILED, 2 total actions
//keyservice/pkg/keystore:keystore-tests FAILED in 0.1s
/root/.cache/bazel/_bazel_root/cf3077b83e930e0c42e53cc2f9959c4d/execroot/cc_gyroscope/bazel-out/local-fastbuild/testlogs/keyservice/pkg/keystore/keystore-tests/test.log

Executed 1 out of 1 test: 1 fails locally.
$ echo $?
0

Benjamin Staffin

unread,
Sep 29, 2017, 3:21:39 PM9/29/17
to bazel-discuss
That is weird - according to bazel's docs, it should be exiting with 3 if any tests failed, not 0: https://docs.bazel.build/versions/master/user-manual.html#what-exit-code-will-i-get

Do you have a wrapper script or helper function around the bazel CLI entrypoint, by any chance? 

Brian Silverman

unread,
Sep 29, 2017, 3:24:14 PM9/29/17
to Benjamin Staffin, bazel-discuss
One place to look is tools/bazel. If you have an executable file there, the /usr/bin/bazel file installed for most of the packages will run that instead of the actual bazel binary.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/05855423-6950-4f78-b122-ba748c1f481b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages