commit | c04f0d41317bfe1f6ff42da94dddb4023587fc26 | [log] [tgz] |
---|---|---|
author | Tobias Werth <twerth@google.com> | Thu Mar 23 01:33:53 2023 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Mar 23 01:35:16 2023 -0700 |
tree | c6f7a1a15d7f68832410b426077de79fed2c73cc | |
parent | c82168eea66609bd0fc3acbc02e837f6a65c3b1b [diff] |
Use less subshells and `tee`s in running tests with `bazel run`. Fixes #17754. What we have seen prior to this change was that sometimes for quick tests the output was swallowed. After a lot of poking it became clear that the culprit is the use of subshell and `tee`, e.g. if you remove `tee` completely from the picture the behavior never shows up. The issue is that with a fast test, `tee` seems to be killed (or its parent subshell) before the printing the output to stdout. With this change, we reduce the number of subshells and processes to set up and reduce the chance of the race condition but not remove it. However, for practical purposes, the race condition is gone. With the reproduction steps in #17754, and this command ``` for i in {1..10000}; do /tmp/bazel run :foo &> /tmp/log ; grep -q "useful echo" /tmp/log ; if [ $? -eq 0 ]; then echo -n '+'; else echo -n '-'; fi; done ``` a bazel from head fails ~3900 out of 10000 times. After this commit, it never failed. Closes #17846. PiperOrigin-RevId: 518794237 Change-Id: I8c1862d3a274799b864f0f5f42b85d6df5af78c7
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only 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.
Follow our tutorials:
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md