Bazel run with tags

Viewed 1484

This is more of a general question regarding the capabilities of Bazel. Does Bazel have the capability of running multiple tests at once based on a tag?

Similar to how bazel build --build_tag_filter=example_test //path/... builds all binaries with the tag "example_test" that are located under //path/...

I was wondering if there was a command option to run multiple binaries with a given tag? ex) bazel run --run_tag_filter=example_test //path/... or something alone those lines

1 Answers

Bazel run only supports executing one binary at a time.

However, you have a couple of options if you want to run tests concurrently:

  1. Use bazel test - I assume you already tried this. You can use --test_tag_filters which has the same effect as --build_tag_filter has on bazel build. You can then control concurrency with --jobs and --local_test_jobs.
  2. You can also use bazel run with --script_path which results in Bazel outputting a shell script which contains all the logic to run the target independently of Bazel. You could, in theory, create a script for each target and then execute them in parallel.
Related