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

Regenerate test.xml with generate-xml.sh when testing remotely with --remote_download_minimal #12554

Closed
coeuvre opened this issue Nov 25, 2020 · 5 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug

Comments

@coeuvre
Copy link
Member

coeuvre commented Nov 25, 2020

Description of the problem:

Normally, when running a test, Bazel expects the test to produce a test.xml. If it is not produced, Bazel will run a separate action using generate-xml.sh to generate that file.

When testing remotely with --remote_download_minimal, Bazel doesn't download the XML file, and then observes that it doesn't exist and so tries to regenerate it, regardless of whether the action actually produced it or not.

Bazel shouldn't regenerate the test.xml if the action actually produced it.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Java tests with junit produce test.xml automatically. You can verify by running a junit test locally (and Bazel won't run the generate-xml.sh action) and find the file under bazel-testlogs folder.

However, when running the test remotely with --remote_download_minimal, you will notice that Bazel will run an additional generate-xml.sh action.

What's the output of bazel info release?

release 3.7.0

Have you found anything relevant by searching the web?

#6862
#11558

@coeuvre coeuvre added type: bug P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team labels Nov 25, 2020
@coeuvre coeuvre self-assigned this Nov 25, 2020
@coeuvre
Copy link
Member Author

coeuvre commented Nov 25, 2020

The root cause is that, "minimal" mode only inject metadata of output which is an instance of Artifact into the filesystem. However, test.xml is an instance of BasicActionInput which is not a subclass of Artifact. Hence, Bazel won't know the existence of that file.

coeuvre added a commit to coeuvre/bazel that referenced this issue Dec 1, 2020
…n be injected

This is achieved by adding test.xml to TestRunnerAction's outputs which means test.xml becomes a mandatory output of TestRunnerAction just like test.log.

test.xml should always be generated by either test actions or the separated spawn action enabled by --experimental_split_xml_generation.

Fixes bazelbuild#12554.
coeuvre added a commit to coeuvre/bazel that referenced this issue Dec 1, 2020
…n be injected

This is achieved by adding test.xml to TestRunnerAction's outputs which means test.xml becomes a mandatory output of TestRunnerAction just like test.log.

test.xml should always be generated by either test actions or the separated spawn action enabled by --experimental_split_xml_generation.

Fixes bazelbuild#12554.
coeuvre added a commit to coeuvre/bazel that referenced this issue Dec 29, 2020
…n be injected

This is achieved by adding test.xml to TestRunnerAction's outputs which means test.xml becomes a mandatory output of TestRunnerAction just like test.log.

test.xml should always be generated by either test actions or the separated spawn action enabled by --experimental_split_xml_generation.

Fixes bazelbuild#12554.
@sventiffe
Copy link
Contributor

@coeuvre this issue is marked as P1 bug but stalled since end of last year. Is this still active work or can it be bumped down to P2?

@coeuvre
Copy link
Member Author

coeuvre commented Feb 3, 2021

The linked patch works for Bazel but need some work on internal code to pass the tests. Bumping down to P2.

@coeuvre coeuvre added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Feb 3, 2021
@daveyc123
Copy link
Contributor

@coeuvre What's the plan for this patch? This is impacting us significantly. Is there a way we can help with the patch? When you refer to "internal code", is this bazel tests or blaze tests?

coeuvre added a commit to coeuvre/bazel that referenced this issue Jun 16, 2021
…n be injected

This is achieved by adding test.xml to TestRunnerAction's outputs which means test.xml becomes a mandatory output of TestRunnerAction just like test.log.

test.xml should always be generated by either test actions or the separated spawn action enabled by --experimental_split_xml_generation.

Fixes bazelbuild#12554.
@coeuvre
Copy link
Member Author

coeuvre commented Jun 17, 2021

"internal code" was referred to blaze tests. I updated the patch to pass internal tests and it is now under review. Should be merge in a few days.

coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 15, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 15, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 15, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 15, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 16, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
larsrc-google pushed a commit to larsrc-google/bazel that referenced this issue Jul 28, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
larsrc-google pushed a commit to larsrc-google/bazel that referenced this issue Jul 30, 2021
…l is generated when build with --remote_download_minimal.

Change test.xml from BasicActionInput to Artifact before executing the spawn so its metadata can be injected.

Use a custom MetadataHandler to allow metadata injections of undeclared outputs.

Fixes bazelbuild#12554.

Closes bazelbuild#12590.

PiperOrigin-RevId: 380741230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants