bzltestutil: fix re-exec failure on Windows when runfiles path exceeds MAX_PATH (#4586)

<!-- Thanks for sending a PR! Before submitting:

1. If this is your first PR, please read CONTRIBUTING.md and sign the
CLA
   first. We cannot review code without a signed CLA.
2. Please file an issue *first*. All features and most bug fixes should
have
an associated issue with a design discussed and decided upon. Small bug
   fixes and documentation improvements don't need issues.
3. New features and bug fixes must have tests. Documentation may need to
be updated. If you're unsure what to update, send the PR, and we'll
discuss
   in review.
4. Note that PRs updating dependencies and new Go versions are not
accepted.
   Please file an issue instead.
-->

**What type of PR is this?**

Bug fix

**What does this PR do? Why is it needed?**

Fix `go_test` failures when the path containing the test executable is
longer than `MAX_PATH`.
The issue stems from `CreateProcess` which will systematically reject
any working directory (whether passed explicitly or to be inherited)
longer than `MAX_PATH`, regardless of longpath prefix (`\\?\`), long
path setting being enabled in the registry, or `longPathAware` being
present in the binary's manifest.

**Which issues(s) does this PR fix?**

AFAIK, there is no open issue.

I initially reported this to go's tracker as
https://github.com/golang/go/issues/78601, but in the context of
`rules_go` I don't think there is one.

**Other notes for review**

I wasn't sure what to do about testing. AFAICS testing `Wrap` might
quickly become over complicated, and testing the new condition in
isolation doesn't bring much. Please let me know if you have something
in mind here!

---------

Co-authored-by: Joseph Gette <jgettepost@gmail.com>
Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
1 file changed