Skip to content

[torchci] Report C++ tests - #200025

Draft
georgehong wants to merge 19 commits into
gh/georgehong/12/basefrom
gh/georgehong/12/head
Draft

georgehong wants to merge 19 commits into
gh/georgehong/12/basefrom
gh/georgehong/12/head

Conversation

@georgehong

@georgehong georgehong commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Summary

Report C++ tests. They run under pytest-cpp rather than run_tests, so run_test.py registers the report plugin for them, and each gtest is named from its pytest-cpp item (file cpp/<binary>, gtest suite and test name, language cpp). C++ tests also run under xdist with -x, which stops before the final failure's teardown report, so runs with a known failure are now written when the session ends. As in junit, a crashed gtest is failed with pytest-cpp's message; xdist worker deaths aren't recorded.

A gtest's file is its binary, since one source can be compiled into several binaries, but owners are keyed by source file. So each run also records def_file, the repo-relative file that defines the test. While pytest-cpp collects a binary, the plugin sets GTEST_OUTPUT, so the --gtest_list_tests it already runs also writes JSON with each test's file. gtest records the absolute path the build compiled, so the writer keeps the longest suffix of it that is a file in the checkout the tests run from. def_file is best effort: it's "" when nothing matches, as for the hipified copies ROCm builds compile, and for Python tests. The replicator ignores it until runs has the column.

For now, this draft writes reports from every CI workflow (IS_CI) to find tests the writer breaks; it goes back to pull and trunk before landing.

Test Plan

python test/torchci/test_testing.py -k test_gtest
python test/run_test.py --cpp -i cpp/test_global_state_manager --save-torchci-reports test/torchci-reports

End to end: this PR's CI, with C++ reports from the test_libtorch shards, including Windows via ciflow/trunk.

Authored with the help of an AI assistant (Claude).

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/200025

Note: Links to docs will display an error until the docs builds have been completed.

❌ You can merge normally! (6 Unrelated Failures), 4 Unclassified Failures

As of commit 8138c4f with merge base 1fe73a1 (image):

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
georgehong added a commit that referenced this pull request Oct 7, 2026
C++ tests run as `pytest <binary>` under pytest-cpp rather than through
run_tests, so run_test.py registers the plugin for them. A gtest is recorded as
file cpp/<binary>, its gtest suite and test name, with language cpp; its
declared name drops a value-parameterized /N suffix. pytest-cpp runs each gtest
in its own process and reports a crash as an ordinary failure, so the writer
recognizes the "returncode=-N" message and records crashed.

Test Plan:

```
python test/test_testing.py -k TestReport -k TestJunitXml
python -m pytest test_demo -n 1 -p torch.testing._internal.torchci.plugin --torchci-report-dir=r  # a gtest binary with a crashing test
lintrunner
```

Authored with the help of an AI assistant (Claude).


ghstack-source-id: cf697d3
Pull-Request: #200025
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@georgehong georgehong added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 11, 2026
@georgehong georgehong added the topic: not user facing topic category label Oct 11, 2026
[ghstack-poisoned]
[ghstack-poisoned]
georgehong added a commit that referenced this pull request Oct 14, 2026
C++ tests run as `pytest <binary>` under pytest-cpp rather than through
run_tests, so run_test.py registers the plugin for them. A gtest is recorded from
its pytest-cpp item as file cpp/<binary>, its gtest suite and test name, with
language cpp; its declared name drops a value-parameterized /<param>. A gtest
whose process crashed is failed, with pytest-cpp's message, as in junit.

run_test.py runs C++ tests under xdist with -x, which stops right after the final
failing report, before the teardown report where the writer writes the run. Runs
whose failure is already known are now written at session end; without that, the
failure that stops a C++ run was missing from its report.

An xdist worker that dies isn't recorded. pytest-rerunfailures sends a test's
reports only after each attempt, so the controller never has the identity of the
test the worker was running, and its node id can't give the declared name of
PyTorch's generated tests, which the test's id hashes. junit and the log still
have it.

Test Plan:

```
python test/torchci/test_testing.py
CPP_TESTS_DIR=<dir with a gtest binary> python test/run_test.py --cpp -i cpp/<binary> --save-torchci-reports <dir>
lintrunner
```

Authored with the help of an AI assistant (Claude).

ghstack-source-id: 9d2e0dd
Pull-Request: #200025
@georgehong georgehong added ciflow/inductor ciflow/xpu Run XPU CI tasks ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/slow ci-no-td Do not run TD on this PR keep-going Don't stop on first failure, keep running tests until the end labels Oct 14, 2026
@georgehong

Copy link
Copy Markdown
Contributor Author

Succeeded by #200980, using this PR as a playground to understand failing tests (if attributable to the reporter).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/inductor ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/slow ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks keep-going Don't stop on first failure, keep running tests until the end topic: not user facing topic category

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant