Skip to content

Add --tree arg to src/tests/run.[sh|cmd]#126232

Merged
jtschuster merged 6 commits intodotnet:mainfrom
jtschuster:feature/run-sh-tree
Mar 31, 2026
Merged

Add --tree arg to src/tests/run.[sh|cmd]#126232
jtschuster merged 6 commits intodotnet:mainfrom
jtschuster:feature/run-sh-tree

Conversation

@jtschuster
Copy link
Copy Markdown
Member

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 --tree argument to src/tests/run.[sh|cmd] to limit the tests run and match the way tests are built.

jtschuster and others added 2 commits March 26, 2026 18:45
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>
@jtschuster jtschuster self-assigned this Mar 27, 2026
@jtschuster jtschuster changed the title Feature/run sh tree Add --tree arg to src/tests/run.[sh|cmd] Mar 27, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/tree argument support to src/tests/run.sh and src/tests/run.cmd, forwarding it to run.py.
  • Add --tree handling to src/tests/run.py, passing /p:TestSubtree=... into the MSBuild RunTests invocation.
  • Update src/tests/Common/tests.targets to scope test discovery globs to $(BaseOutputPathWithConfig)\$(TestSubtree)\** when TestSubtree is 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.

Comment thread src/tests/run.cmd Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 28, 2026 17:24
@jtschuster jtschuster enabled auto-merge (squash) March 28, 2026 17:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/tests/run.sh
Comment thread src/tests/run.cmd Outdated
Comment thread src/tests/Common/tests.targets Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 30, 2026 18:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/tests/run.sh Outdated
jtschuster and others added 2 commits March 30, 2026 11:26
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>
@jtschuster jtschuster merged commit dd96f2c into dotnet:main Mar 31, 2026
88 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants