Skip to content

Conversation

abhinav
Copy link
Contributor

@abhinav abhinav commented May 6, 2025

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

This PR adds a test to reproduce the issue described in #4335,
and proposes one possible fix for it:
leveraging an environment variable to help the subprocess determine
whether it was invoked by Bazel or directly.

The test fails without the proposed fix,
but it succeeds fine with go test.

Which issues(s) does this PR fix?

Fixes #4335

Other notes for review

The proposed fix is one possible way of doing this.
I welcome feedback from maintainers on other approaches here.

@abhinav abhinav changed the title [wip] re-spawned test binary should not break PWD Re-spawned test binary should not break PWD May 6, 2025
@abhinav abhinav marked this pull request as ready for review May 6, 2025 18:08
abhinav added 3 commits May 7, 2025 10:25
This change adds a test to reproduce the behavior described in
bazel-contrib#4335.

The test passes with vanilla 'go test', but not with rules_go.
@abhinav abhinav force-pushed the go_test-subprocess-chdir branch from 8035fc6 to 0d6d42d Compare May 7, 2025 17:28
@fmeum
Copy link
Member

fmeum commented May 7, 2025

Thanks!

@fmeum fmeum merged commit 608bd43 into bazel-contrib:master May 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bzltestutil changes the working directory for respawned test-executables
2 participants