bazel: test inconsistent No test targets were found, yet testing was requested
Description of the problem:
When package package has no test targets, bazel test //package/... sometimes succeeds, sometimes doesn’t.
The former case:
> bazel test //package/...
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
The latter:
2019-01-29T15:15:58.9218544Z INFO: Build completed successfully, 3 total actions
2019-01-29T15:15:58.9227697Z ERROR: No test targets were found, yet testing was requested
2019-01-29T15:15:58.9292161Z INFO: Build completed successfully, 3 total actions
2019-01-29T15:15:58.9524112Z ##[error]Bash exited with code '4'.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I’ve only seen the ERROR: ... case occur on the rules_haskell CI, with this config:
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- bash: |
set -e
curl -LO https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-windows-x86_64.exe
mv bazel-*.exe bazel.exe
mkdir /c/bazel
mv bazel.exe /c/bazel
displayName: 'Install Bazel'
- bash: |
set -e
export MSYS2_ARG_CONV_EXCL="*"
...
# !!!
# Replacing `build` with `test` fails the job
/c/bazel/bazel.exe build --config windows "//tests/data/..."
...
displayName: 'Run Bazel'
What operating system are you running Bazel on?
Windows with vmImage: 'vs2017-win2016'
I’m unable to reproduce the issue on other Windows machines.
What’s the output of bazel info release?
release 0.21.0
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Remove test run and display Bazel version being used Trying to run tests when not having test can produce some issue https://github.com/bazelbuild/bazel/issues/7291 For the moment we just remove the ... — committed to limdor/tlpi by limdor 3 years ago
- Remove test run and display Bazel version being used Trying to run tests when not having test can produce some issue https://github.com/bazelbuild/bazel/issues/7291 For the moment we just remove the ... — committed to limdor/tlpi by limdor 3 years ago
--treat_no_tests_as_success_return_codewould be great to have, usecase is usingbazel queryto select test targets, for example to--jobs Ndifferently for different test sets (based on size for example)bazel coveragevsbazel testdepending on some queryFiltering all test by tags isn’t always expressive enough.
No, unless the bug is the same confusion over output / suppressed ERROR messages with implicit
--curses yes.