bazel: --distinct_host_configuration=false causes conflicting actions on bazel test --test_arg
Description of the problem:
Enabling --distinct_host_configuration=false
causes tests to fail to build when --test_arg
is set.
Specifically, a bazel test --test_arg=...
following a bazel test
without --test_arg
set fails in this manner.
The test succeeds if both commands do not set --test_arg
or if both set the same --test_arg
.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Make sure to have bazelisk
installed and run the following script in an empty directory.
echo USE_BAZEL_VERSION=5.0.0 >.bazeliskrc
touch WORKSPACE
cat >BUILD.bazel <<EOF
sh_test(
name = "test",
srcs = ["test.sh"],
)
EOF
touch test.sh
chmod +x test.sh
cat >.bazelrc <<EOF
test --nocache_test_results
EOF
echo SUCCEEDS
bazel test //:test; bazel test //:test --test_arg=foo
cat >>.bazelrc <<EOF
build --distinct_host_configuration=false
EOF
echo FAILS
bazel test //:test; bazel test //:test --test_arg=foo
Note, this seems to be a regression. Using Bazel version 4.2.2 instead of 5.0.0 does not trigger this issue.
What operating system are you running Bazel on?
Ubuntu 21.04
What’s the output of bazel info release
?
release 5.0.0
Any other information, logs, or outputs that you want to share?
This issue was discovered here and then stripped down to a minimal repro.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 20 (12 by maintainers)
Commits related to this issue
- set --distinct_host_configuration=false by default for linux builds — committed to tensorflow/tensorflow by deleted user 3 years ago
- Adding missing --host_copt for Windows. This didn't matter because we have --distinct_host_configuration=true enabled for Windows, but this flag is an no-op with Bazel@HEAD, see https://github.com/ba... — committed to tensorflow/tensorflow by tensorflower-gardener 2 years ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
- Speed up build by avoiding build config duplication Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twi... — committed to cloudflare/workerd by fhanau a year ago
One of the problems here is that tensorflow makes the assumption that the host platform is the target platform. The .bazelrc file magically does that here: https://github.com/tensorflow/tensorflow/blob/de2e1fe1d809aa91ba5910f0e563b3cd47990ada/.bazelrc#L128 and then in configs, like this; https://github.com/tensorflow/tensorflow/blob/de2e1fe1d809aa91ba5910f0e563b3cd47990ada/.bazelrc#L295
This is a mistaken use of the option
--enable_platform_specific_config
. It was intended to change the things that might vary for a user based on which of several platforms they build for. For example, if they need different URLs for RBE based on the OS they are invoking from. The idiomatic bazel usage is to declare each platform, e.g.and explicitly build with
--config=win
or--config=macos
.@sdtwigg is the expert on this.