Fix #7515: bazel_rules_test fails on Windows.

The test had a couple of problems:
- A misunderstanding of how PATH looks like in MSYS on Windows - it's not delimited by ';', but by ':'. Drive letters are not a problem, because MSYS represents these as virtual directories (e.g. C:\TEST becomes /c/TEST). By using a ';', the first entry in the PATH became invalid, which lead to the Bazel wrapper no longer being found.
- "export env variables and then try to restore them later" instead of just calling exactly the program that should use them with the env vars explicitly set. This is problematic, because the env vars do not get restored in case of failure and also because it's overly broad.
- Rewriting the existing tool "env" using "echo" and a select() construct.
- Didn't redirect output of "bazel" into $TEST_log.

By setting PATH to a wrong value on Windows, this caused the "bazel" command in the test to accidentally run the "bazel" binary from the system instead of the runfiles, so the test didn't test the correct Bazel version. We only noticed this when we replaced the "bazel" binary on the CI machines with Bazelisk, which crashed, because $HOME (Linux, macOS) and %LocalAppDir% were not set and Bazelisk requires these.

RELNOTES: None.
PiperOrigin-RevId: 235490629
1 file changed
tree: 475b73c4f731693b71d4afd075104c502779bf8d
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .gitattributes
  9. .gitignore
  10. AUTHORS
  11. BUILD
  12. CHANGELOG.md
  13. CODEOWNERS
  14. combine_distfiles.py
  15. combine_distfiles_to_tar.sh
  16. compile.sh
  17. CONTRIBUTING.md
  18. CONTRIBUTORS
  19. distdir.bzl
  20. ISSUE_TEMPLATE.md
  21. LICENSE
  22. README.md
  23. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel only rebuilds what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status

Bazel is released in ‘Beta’. See the product roadmap to learn about the path toward a stable 1.0 release.