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

gtest sharding breaks lit's xfail inputs #102264

Open
kendalharland opened this issue Aug 7, 2024 · 1 comment
Open

gtest sharding breaks lit's xfail inputs #102264

kendalharland opened this issue Aug 7, 2024 · 1 comment

Comments

@kendalharland
Copy link
Contributor

kendalharland commented Aug 7, 2024

Lit marks tests as XFAIL by generating a list of discovered_tests and marking each of them as XFAIL if their relative filenames or fullnames appear in its opts.xfail which is populated from either the --xfail-tests flag or LIT_XFAIL env var before the tests actually run. When gtest sharding is enabled, every test's name in discovered_tests initially contains a numeric suffix like FooTest\1\2 before the tests runs, so the test names don't match the names the User passes to the arguments above. The googletest module will replace these numbers with the actual test suite and case names by reading them from gtest json files only after the tests are finished running. This means that it's impossible to mark a test as XFAIL using the above mechanisms when gtest sharding is enabled. One can only use the Python test decorators, or the shell test XFAIL: headers, or any of the other source-code based mechanisms.

@kendalharland
Copy link
Contributor Author

Related to #56492

JDevlieghere pushed a commit that referenced this issue Aug 16, 2024
…02986)

When a test case inside of a gtest suite fails, we report a failure
which causes the entire `ninja check-lldb` invocation to fail, even if
the outer test case is marked as XFAIL - each test case result is
reported as its own lit test run. This PR updates lit so it checks
whether each test case's parent test suite is XFAIL before setting the
status to FAIL.

This is especially problematic because the failing tests can't manually
be marked as XFAIL, due to
#102264.

Fixes #102265

### Repro instructions

1. Modify any gtest test case to generate a failure.
2. Mark the outer lit test with XFAIL using either `--xfail-tests` flag
or `LIT_XFAIL` env var.
3. Run the tests
4. Observe the lit test is XFAIL as expected, but the failed child test
cases show up as separate failures.

Co-authored-by: kendal <kendal@thebrowser.company>
kendalharland added a commit to kendalharland/llvm-project that referenced this issue Sep 12, 2024
…vm#102986)

When a test case inside of a gtest suite fails, we report a failure
which causes the entire `ninja check-lldb` invocation to fail, even if
the outer test case is marked as XFAIL - each test case result is
reported as its own lit test run. This PR updates lit so it checks
whether each test case's parent test suite is XFAIL before setting the
status to FAIL.

This is especially problematic because the failing tests can't manually
be marked as XFAIL, due to
llvm#102264.

Fixes llvm#102265

### Repro instructions

1. Modify any gtest test case to generate a failure.
2. Mark the outer lit test with XFAIL using either `--xfail-tests` flag
or `LIT_XFAIL` env var.
3. Run the tests
4. Observe the lit test is XFAIL as expected, but the failed child test
cases show up as separate failures.

Co-authored-by: kendal <kendal@thebrowser.company>
(cherry picked from commit 9f89d31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant