Skip to content

[testing] Add --save-test-run-reports to run_test.py and run_tests - #200023

Closed
georgehong wants to merge 16 commits into
gh/georgehong/10/basefrom
gh/georgehong/10/head
Closed

georgehong wants to merge 16 commits into
gh/georgehong/10/basefrom
gh/georgehong/10/head

Conversation

@georgehong

@georgehong georgehong commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Overview
--save-torchci-reports DIR registers the torchci plugin, which writes each test process's report to <DIR>/<file>-<uuid>.report.jsonl. Off by default. run_test.py only forwards the flag when the installed torch has the writer, since tests sometimes run against a nightly.

Test Plan

python test/run_test.py -i test_type_info --save-torchci-reports /tmp/test/torchci-reports/

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/200023

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

✅ No Failures

As of commit 9849c12 with merge base 816fc3c (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - PR requires human review:

  • Triviality
    • New feature, not a trivial class: adds a --save-torchci-reports option to test/run_test.py and common_utils.run_tests
    • test/run_test.py is the test runner, which the Additive and Explained test change classes exclude
  • Runtime behavior
    • run_tests now registers torch.testing._internal.torchci.plugin via -p and forwards the flag to subprocess children when it is set
    • run_ci_sanity_check now deletes *.report.jsonl files under the reports dir, a new filesystem side effect
  • Socialization
    • Adds a public-facing CLI flag and a report file layout documented in torch/testing/_internal/torchci/README.md that downstream tooling will parse

reason: not_trivial
Reviewed commit: 9849c12

Inference job

🐛 Report a wrong verdict

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
`--save-test-run-reports [DIR]` registers the torchci plugin, with one folder
per test file; `--no-save-test-run-reports` turns it off. Off by default.
run_test.py only forwards the flag when the installed torch has the writer,
since tests sometimes run against a nightly.

Test Plan:

```
python test/test_testing.py -k TestReport -k TestJunitXml
python test/run_test.py -i test_type_info --save-test-run-reports
lintrunner
```

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


ghstack-source-id: 8b73cff
Pull-Request: #200023
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@georgehong georgehong added the topic: not user facing topic category label Oct 8, 2026
[ghstack-poisoned]
@georgehong georgehong changed the title [testing] Add --save-test-run-reports to run_test.py and run_tests [testing] Add --save-torchci-reports to run_test.py and run_tests Oct 8, 2026
@georgehong georgehong changed the title [testing] Add --save-torchci-reports to run_test.py and run_tests [testing] Add --save-test-run-reports to run_test.py and run_tests Oct 8, 2026
@georgehong
georgehong requested review from huydhn and jathu October 8, 2026 17:02
@georgehong
georgehong marked this pull request as ready for review October 8, 2026 17:03
@georgehong
georgehong requested a review from a team as a code owner October 8, 2026 17:03
Comment thread torch/testing/_internal/common_utils.py Outdated
Comment on lines +1194 to +1195
parser.add_argument('--no-save-torchci-reports', dest='save_torchci_reports',
action='store_const', const=None, default=argparse.SUPPRESS)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why do we need this? This is the behavior if they leave --save-torchci-reports out anyways

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in latest version. Was originally included to match the existing test-reports structure.

Comment thread torch/testing/_internal/common_utils.py Outdated
Comment on lines +1192 to +1193
parser.add_argument('--save-torchci-reports', nargs='?', type=str,
const=TORCHCI_REPORTS_DIR, default=None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of providing a default, let's just always expect them to include a path? I was slightly confused where this was being written because there are more than one path to decide

@georgehong
georgehong marked this pull request as draft October 8, 2026 21:14
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@georgehong
georgehong marked this pull request as ready for review October 9, 2026 05:13
[ghstack-poisoned]
[ghstack-poisoned]
@georgehong georgehong added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 9, 2026
@georgehong

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
…ytorch#200023)

**Overview**
`--save-torchci-reports DIR` registers the torchci plugin, which writes each test process's report to `<DIR>/<file>-<uuid>.report.jsonl`. Off by default. *run_test.py* only forwards the flag when the installed torch has the writer, since tests sometimes run against a nightly.

**Test Plan**
```
python test/run_test.py -i test_type_info --save-torchci-reports /tmp/test/torchci-reports/
```

Authored with the help of an AI assistant (Claude).
Pull Request resolved: pytorch#200023
Approved by: https://github.com/jathu
ghstack dependencies: pytorch#200339, pytorch#200022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants