Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go_test: combine testinit and wrapper packages into bzltestutil #2755

Merged
merged 1 commit into from Dec 4, 2020

Conversation

jayconrod
Copy link
Contributor

testinit was a package used to change directories to the package
directory where tests normally run.

The wrapper sources were compiled into the test main package and were
used to re-execute the test binary in order to capture stdout and
stderr and translate verbose test output to XML.

The change combines both into the bzltestutil package. Like testinit,
it's imported by all generated test mains and should be initialized
before any other package outside std.

This fixes an issue where we changed directories before re-executing
the test binary to capture XML output. If os.Args[0] was a relative
path, it would no longer be meaningful.

Fixes #2749

testinit was a package used to change directories to the package
directory where tests normally run.

The wrapper sources were compiled into the test main package and were
used to re-execute the test binary in order to capture stdout and
stderr and translate verbose test output to XML.

The change combines both into the bzltestutil package. Like testinit,
it's imported by all generated test mains and should be initialized
before any other package outside std.

This fixes an issue where we changed directories before re-executing
the test binary to capture XML output. If os.Args[0] was a relative
path, it would no longer be meaningful.

Fixes bazelbuild#2749
@google-cla google-cla bot added the cla: yes label Dec 4, 2020
@jayconrod jayconrod merged commit 642ff3d into bazelbuild:master Dec 4, 2020
@jayconrod jayconrod deleted the test-cd-xml branch December 4, 2020 18:07
Copy link
Contributor

@dragonsinth dragonsinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

jayconrod pushed a commit that referenced this pull request Dec 23, 2020
testinit was a package used to change directories to the package
directory where tests normally run.

The wrapper sources were compiled into the test main package and were
used to re-execute the test binary in order to capture stdout and
stderr and translate verbose test output to XML.

The change combines both into the bzltestutil package. Like testinit,
it's imported by all generated test mains and should be initialized
before any other package outside std.

This fixes an issue where we changed directories before re-executing
the test binary to capture XML output. If os.Args[0] was a relative
path, it would no longer be meaningful.

Fixes #2749
@linzhp linzhp mentioned this pull request Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go_test: can't run a test binary wrapped by another test
2 participants