bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.19k stars 4.06k forks source link

Running a test on a Windows executor from a Linux host is not possible #19209

Open tjgq opened 1 year ago

tjgq commented 1 year ago

It's currently not possible to run a *_test rule on a remote Windows executor when Bazel is running on a Linux host.

Note that it's possible to run a genrule on Windows from a Linux host, showing that this is a testing-specific issue rather than a more general one with cross-platform Windows builds.

A minimal repro is available at https://github.com/jtattermusch/win-from-linux-rbe-repro (thanks @jtattermusch!). You must use a Bazel built at or after 2f0948b.

We should consider publishing the tw.exe, xml.exe and launcher.exe binaries to an external repository and fetch it on demand when a test is configured for Windows. This would avoid unnecessarily increasing the Bazel binary size, introducing useless dependencies on other platforms, or requiring a C++ cross compiler only for running tests.

jtattermusch commented 1 year ago

Since tw.exe and xml.exe (and launcher.exe) binaries are easily obtained (they are bundled with bazel.exe on windows), it would be good to document a workaround for providing these .exe binaries myself and convincing bazel linux binary to use them in a build.

If lucky, such workaround (if it exists) would allow me to run sh_test and 'native_test` rules on windows executor from linux host or it would possibly reveal whether other non-yet-known issues exist with the cross-platform execution.

tjgq commented 1 year ago

A Bazel with (unconditionally) embedded {tw,xml,launcher}.exe binaries can be built from https://github.com/tjgq/bazel/tree/win-rbe-fixes (for investigation purposes only; not planning to submit as-is).

meisterT commented 1 year ago

cc @meteorcloudy

meteorcloudy commented 1 year ago

Yeah, I agree we should move stuff out of @bazel_tools as much as possible, especially platform specific dependencies, hopefully that is easier in the Bzlmod world.

github-actions[bot] commented 5 days ago

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.