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

Run tests in runfiles directory without LCOV_MERGER #15030

Closed
wants to merge 1 commit into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Mar 12, 2022

collect_coverage.sh has the execution root as it's working directory, but tests should still be run from their runfiles directory if LCOV_MERGER is missing.

`collect_coverage.sh` has the execution root as it's working directory, but tests should still be run from their runfiles directory  if `LCOV_MERGER` is missing.
@fmeum fmeum requested a review from lberki as a code owner March 12, 2022 17:37
@fmeum
Copy link
Collaborator Author

fmeum commented Mar 12, 2022

@keith @c-mita

keith added a commit to keith/bazel that referenced this pull request Mar 12, 2022
As discovered in bazelbuild#15030 there
was another bug with the short circuiting coverage logic where tests
were not run from the correct directory. In that PR this issue is fixed
directly, with this change we instead make missing LCOV_MERGER be
deferred until after all test setup and run, which I think is more
future proof to other changes here, and also allows users to know their
tests are being run with coverage, and output the correct files, even in
the case they don't setup the coverage merger infrastructure.
@keith
Copy link
Member

keith commented Mar 12, 2022

Thanks for submitting this! Seeing another issue with this setup code I submitted this alternative that I think would be more future proof, but it's up to @c-mita to decide on which approach makes sense. Can you add a test similar to the runfiles tests I added in my PR to catch regressions in the case @c-mita wants to go with this change?

#15031

keith added a commit to keith/bazel that referenced this pull request Mar 12, 2022
As discovered in bazelbuild#15030 there
was another bug with the short circuiting coverage logic where tests
were not run from the correct directory. In that PR this issue is fixed
directly, with this change we instead make missing LCOV_MERGER be
deferred until after all test setup and run, which I think is more
future proof to other changes here, and also allows users to know their
tests are being run with coverage, and output the correct files, even in
the case they don't setup the coverage merger infrastructure.
@fmeum
Copy link
Collaborator Author

fmeum commented Mar 12, 2022

I also think that the approach of #15031 is more future-proof. I can't edit the PR at the moment, but will do so in case the other PR can't be used for some reason.

@c-mita
Copy link
Member

c-mita commented Mar 14, 2022

I think @keith's approach is better here; deferring the LCOV_MERGER test to be after all the setup is what I should have tried to do in the first place.

@fmeum fmeum closed this Mar 14, 2022
bazel-io pushed a commit that referenced this pull request Mar 15, 2022
As discovered in #15030 there
was another bug with the short circuiting coverage logic where tests
were not run from the correct directory. In that PR this issue is fixed
directly, with this change we instead make missing LCOV_MERGER be
deferred until after all test setup and run, which I think is more
future proof to other changes here, and also allows users to know their
tests are being run with coverage, and output the correct files, even in
the case they don't setup the coverage merger infrastructure.

Closes #15031.

PiperOrigin-RevId: 434715347
fmeum pushed a commit to fmeum/bazel that referenced this pull request Mar 15, 2022
As discovered in bazelbuild#15030 there
was another bug with the short circuiting coverage logic where tests
were not run from the correct directory. In that PR this issue is fixed
directly, with this change we instead make missing LCOV_MERGER be
deferred until after all test setup and run, which I think is more
future proof to other changes here, and also allows users to know their
tests are being run with coverage, and output the correct files, even in
the case they don't setup the coverage merger infrastructure.

Closes bazelbuild#15031.

PiperOrigin-RevId: 434715347
Wyverald pushed a commit that referenced this pull request Mar 15, 2022
As discovered in #15030 there
was another bug with the short circuiting coverage logic where tests
were not run from the correct directory. In that PR this issue is fixed
directly, with this change we instead make missing LCOV_MERGER be
deferred until after all test setup and run, which I think is more
future proof to other changes here, and also allows users to know their
tests are being run with coverage, and output the correct files, even in
the case they don't setup the coverage merger infrastructure.

Closes #15031.

PiperOrigin-RevId: 434715347

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
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.

3 participants