Add --tree arg to src/tests/run.[sh|cmd]#126232
Merged
jtschuster merged 6 commits intodotnet:mainfrom Mar 31, 2026
Merged
Conversation
The build.sh -tree flag allows building a subtree of tests, but run.sh had no equivalent for running a subset. This meant users had to either run the entire test suite or manually configure test paths. Add a --tree flag to run.sh, run.cmd, and run.py that passes a TestSubtree MSBuild property to tests.targets. When set, the test discovery globs are scoped to the specified subtree directory instead of scanning the entire output tree. Example usage: src/tests/run.sh checked --tree=JIT/Regression src/tests/run.cmd checked tree JIT\Regression Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When TestSubtree is set but no tests are found, show a specific error mentioning the subtree path instead of the generic 'Tests must be built' message, which would be misleading in this case. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a subtree-filtering option to the CoreCLR test run scripts so developers (and automation) can run only tests under a specific portion of the built test layout, aligning with the “tree” concept used during test builds.
Changes:
- Add
--tree/treeargument support tosrc/tests/run.shandsrc/tests/run.cmd, forwarding it torun.py. - Add
--treehandling tosrc/tests/run.py, passing/p:TestSubtree=...into the MSBuild RunTests invocation. - Update
src/tests/Common/tests.targetsto scope test discovery globs to$(BaseOutputPathWithConfig)\$(TestSubtree)\**whenTestSubtreeis provided, and emit a clearer error when no tests are found in that subtree.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/tests/run.sh | Parses --tree=<path> and forwards --tree <path> to run.py. |
| src/tests/run.py | Adds --tree arg and forwards it to MSBuild as TestSubtree. |
| src/tests/run.cmd | Parses tree <path> and forwards --tree <path> to run.py. |
| src/tests/Common/tests.targets | Restricts marker discovery to the provided subtree and improves “no tests found” messaging. |
jkoritzinsky
approved these changes
Mar 28, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
run.cmd: Normalize '/', '-', '--' prefixes for the tree argument like build.cmd does, and quote the value when passing to run.py. run.sh: Accept --tree <path>, --tree:<path>, and -tree variants in addition to --tree=<path>, matching build.sh conventions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…untime into feature/run-sh-tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copilot (and me) often want to use the same --tree arg when running tests with ./src/tests/run.sh that is used when building, or only run a subset of tests that have been built. This would enable tighter workflows, fewer copilot digressions to figure out how to actually run the tests, and unify the scripts.
Add a
--treeargument tosrc/tests/run.[sh|cmd]to limit the tests run and match the way tests are built.