feat: support --noenable_runfiles on linux and windows, new runfiles bat macro, fix tests for windows #872
+800
−211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains an update of the runfiles code in windows_utils.bzl to match the runfiles v3 standard (compatible with latest bzlmod). I've also taken the opportunity to fix many tests to work under windows, both with --enable_runfiles and --noenable_runfiles, which required using the new runfiles code to correctly resolve data.
I suspect that the existing tests on linux don't/can't currently validate --noenable_runfiles behaviour of the underlying rules.
Whilst under linux
bazel test
always enables runfiles (ignoring the --noenable_runfiles flag bazelbuild/bazel#22856), under windows this flag does have effect, and is the default, so getting tests clean on windows require test cases to handle runfiles manifests. Also, this would seem to be the only way that we can validate that the rules we are testing work correctly without runfiles.I have added a test runner script that runs each test case with
bazel run
, simulating windows behaviour with --noenable_runfiles. This script has some caveats, namely that it writes test outputs to source tree. See lib/tests/README.md for more.The only windows failures are now in directories with missing windows packages: lib/tests/tar,lib/tests/assert_archive_contains,lib/tests/zstd. Missing packages are unzip, bsdtar, zstd. Additionally, 3 bats tests timeout on windows, there seems to be some kind of concurrency issue. With tags=["exclusive"], they pass occasionally but most often still timeout.
@meteorcloudy @fmeum
Changes are visible to end-users: yes
Suggested release notes
Test plan
Test results: linux - before
Test results: linux - after
Note: an extra 4 are skipped as I have marked them as incompatible with noenable_runfiles
Test results: windows - before
Baseline failures (test enable runfiles):
Test results: windows - after