Skip to content

Build isolated test assets for single TFM instead of 7#6

Closed
nohwnd wants to merge 3 commits intomainfrom
optimize-isolated-test-asset-single-tfm
Closed

Build isolated test assets for single TFM instead of 7#6
nohwnd wants to merge 3 commits intomainfrom
optimize-isolated-test-asset-single-tfm

Conversation

@nohwnd
Copy link
Owner

@nohwnd nohwnd commented Mar 19, 2026

Summary

\GetIsolatedTestAsset\ now takes a \ argetFramework\ parameter and rewrites the csproj to build only that TFM. Previously, test assets built for all 7 target frameworks (
et462;net472;net48;net8.0;net9.0;net10.0;net11.0) even though the test assertions only need output from one.

Before/After (measured)

Test Before After Savings
\MSBuildLoggerCanBeEnabledByBuildPropertyAndDoesNotEatSpecialChars\ 76.1s 14.6s 81%
\RunDotnetTestWithCsprojPassInlineSettings\ 61.7s 14.5s 77%
\MSBuildLoggerCanBeDisabledByEnvironmentVariableProperty\ 82.5s 66.1s 20%

Changes

  • *\AcceptanceTestBase.GetIsolatedTestAsset* — new overload accepts \ argetFramework, rewrites <TargetFrameworks>\ → <TargetFramework>\ in the copied csproj
  • 6 callers updated in \DotnetTestMSBuildOutputTests, \DotnetTestTests, \RunsettingsTests\ to pass
    unnerInfo.TargetFramework\

nohwnd and others added 3 commits March 19, 2026 12:00
* Update matrix

* Remove runtimes

* Update test/TestAssets/MSTestProject2/UnitTest1.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/TestAssets/MSTestProject1/UnitTest1.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update eng/Versions.props

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Split tests

* Remove skip that is no longer needed

* wip

* move tests

* categories

* Update pipelines

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @nohwnd

* Apply suggestion from @nohwnd

* remove extra file

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* don't 'silently' skip

* speed up blame, and fix paralllization of tests that check process count

* Fix the flag

* fix typo in the parameter name

* Revert not filtering on linux

* missing runsettings

* Allow changing test runner arguments in proj

* Typo

* pr fixes

* Duplicated test

* move changes, add some more speedups

* fx

* Fix procdump tests

* Resolve test assets from global if needed

* Increase timeout

* Break infinite restore loop in VS

* Go back to default timeout on wrapper, cannot repro locally

* timeout?

* Add more diags, and hopefully upload logs

* where did I put the serialization?

* print logs

* fix errors for moved logs folder

* Upload artifacts

* thread safe list

* Flakiness

* Indicator test flakiness

* revert diag log

* Using

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix ci build

* filter
GetIsolatedTestAsset now takes a targetFramework parameter and rewrites
the csproj to build only that TFM. Previously, test assets built for all
7 target frameworks (net462;net472;net48;net8.0;net9.0;net10.0;net11.0)
even though the test assertions only need output from one.

Results on affected tests:
- MSBuildLoggerCanBeEnabledByBuildPropertyAndDoesNotEatSpecialChars: 76s -> 15s
- RunDotnetTestWithCsprojPassInlineSettings: 62s -> 15s
- MSBuildLoggerCanBeDisabledByEnvironmentVariableProperty: 83s -> 66s
- MSBuildLoggerCanBeDisabledByBuildProperty: 50s -> ~15s (estimated)
- RunDotnetTestWithCsproj: 45s -> ~15s (estimated)
- RunSettingsAreLoadedFromProject: 31s -> ~15s (estimated)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd nohwnd closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant