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

Bazel does not accept certain time values on testcases #24605

Open
travisdowns opened this issue Dec 7, 2024 · 3 comments
Open

Bazel does not accept certain time values on testcases #24605

travisdowns opened this issue Dec 7, 2024 · 3 comments
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: bug untriaged

Comments

@travisdowns
Copy link

travisdowns commented Dec 7, 2024

Description of the bug:

bazel test consumes the rest result file written to the location specified by env var XML_OUTPUT_FILE, which is in "junit result format" and might look like so:

<testsuite tests="17" skipped="0" errors="0" failures="0" id="0" name="auto_fmt" time="0.000938">
<testcase assertions="1" name="auto_fmt_0" time="1.1e0">
</testcase>
...
</testsuite>

Note the time="1.1e0" attribute on the first testcase. Bazel correctly parses this as 1.1 seconds. However, if the value is 1e0 (or any other value without any decimal point to the left of the e), the parsing apparently fails and bazel reports 0 test cases for the entire test (even if only 1 testcase has such a value).

Having a no decimal point is generally valid (most langs accept this, I could not find a counter-example at least) and this should be parsed correctly.

These values were written by Boost test's JUNIT writer.

Which category does this issue belong to?

Core

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

create a test that just writes the following to the XML_OUTPUT_DIR location:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="repro" time="0.000938">
<testcase assertions="1" name="repro_tc" time="1e0">
</testcase>
</testsuite>

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 7.4.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

I downloaded bazel.

What's the output of git remote get-url origin; git rev-parse HEAD ?

n/a

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

Did not attempt.

Any other information, logs, or outputs that you want to share?

JUNIT XML schema seems to define this field as xs:decimal type which arguably should not support scientific notation at all, but in any case Bazel is correctly parsing the cases with a decimal point, which seems inconsistent.

@github-actions github-actions bot added the team-Core Skyframe, bazel query, BEP, options parsing, bazelrc label Dec 7, 2024
@rockwotj
Copy link
Contributor

rockwotj commented Dec 7, 2024

Seems like this is maybe a Java issue?

EDIT: hrm Double.parseDouble seems fine with this:

Screenshot 2024-12-06 at 9 24 01 PM

@rockwotj
Copy link
Contributor

rockwotj commented Dec 7, 2024

A hacky fix: 3da4989

(also note that comment is a bit backwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: bug untriaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants