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

test_tag_filter should imply build_tag_filter in bazel test command #8439

Open
ghost opened this issue May 22, 2019 · 4 comments
Open

test_tag_filter should imply build_tag_filter in bazel test command #8439

ghost opened this issue May 22, 2019 · 4 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: feature request

Comments

@ghost
Copy link

ghost commented May 22, 2019

Description of the problem / feature request:

Right now, the somewhat innocent looking command

$ bazel test //... --test_tag_filters=my-specific-tag

builds far more than it needs to to run the specified test.

As far as I can tell, this is because bazel is interpreting the test command as

$ bazel build [label] [options]
$ bazel test [label] [options]

and since the first part of that ignores --test_tag_filters, the above innocent-looking command expands to

$ bazel build //...
$ bazel test //... --test_tag_filters=my-specific-tag

This is very counter-intuitive.

I suggest that the build part of a bazel test command use the same analysis as the test part of that command, so only the required test targets (and their dependencies) are built.

Feature requests: what underlying problem are you trying to solve with this feature?

Fixing counter-intuitive command-line behaviour, reducing accidentally very long builds.

What operating system are you running Bazel on?

Ubuntu 18.04

What's the output of bazel info release?

$ bazel info release
release 0.23.2
@ishikhman ishikhman added team-Bazel General Bazel product/strategy issues type: feature request untriaged labels May 23, 2019
@dslomov dslomov added team-Local-Exec Issues and PRs for the Execution (Local) team and removed team-Bazel General Bazel product/strategy issues labels Jul 5, 2019
bmzhao referenced this issue in tensorflow/tensorflow Sep 6, 2019
PiperOrigin-RevId: 267466701
@susinmotion susinmotion added team-Core Skyframe, bazel query, BEP, options parsing, bazelrc and removed team-Local-Exec Issues and PRs for the Execution (Local) team labels Sep 17, 2019
@janakdr
Copy link
Contributor

janakdr commented Apr 20, 2020

Does the flag --build_tests_only work to make Bazel behave as you expect in this case?

@janakdr janakdr assigned ghost Apr 20, 2020
@janakdr janakdr removed the untriaged label Apr 20, 2020
@aiuto
Copy link
Contributor

aiuto commented Apr 21, 2020

Perhaps --test_tag_filters should imply use of build_tests_only.
OR.... perhaps bazel test should imply build_tests_only, so that if you actually want to build everything, you' would have to add --nobuild_tests_only. That seems like reasonable behavior, but I'm sure that would upset someones process.

bazel-io pushed a commit that referenced this issue Aug 5, 2020
…unning `blaze test`.

#8439

PiperOrigin-RevId: 325117049
ehkloaj pushed a commit to ehkloaj/bazel that referenced this issue Aug 6, 2020
@janakdr janakdr added the P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) label Nov 8, 2020
@dmivankov
Copy link
Contributor

Another interesting related note is how //... doesn't include manual targets but $(bazel query //...) does and --test_tag_filters=-manual isn't enough to prevent building manual targets.

Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants