Repository navigation
Accelerate affected-test collection and prepare isolated CTS comparison #12191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Amaury Levé (Evangelink)
merged 8 commits into
main
from
dev/amauryleve/affected-test-collection
Nov 4, 2026
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2464492
Accelerate affected-test collection and prepare CTS comparison
Evangelink 083dd4f
Record committed collection package and runtime evidence
Evangelink d2bc187
Record complete real-module collection validation
Evangelink 2a2240b
Record measured acceptance fixture and batching profiles
Evangelink 531ac4c
Merge main and preserve collection cache test coverage
Evangelink 0d6badf
Confirm owned collection descendants exit before cache release
Evangelink aaba94c
Reconcile committed CTS maps with every selected module
Evangelink e7fb415
Address grouped collection review feedback
Evangelink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "version": 1, | ||
| "isRoot": true, | ||
| "tools": { | ||
| "cts": { | ||
| "version": "2.13.0-alpha.26530.1", | ||
| "commands": [ | ||
| "cts" | ||
| ], | ||
| "rollForward": false | ||
| } | ||
| } | ||
| } |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| [CmdletBinding()] | ||
| param( | ||
| [string]$Repository = (Split-Path $PSScriptRoot -Parent), | ||
| [ValidateSet("Debug", "Release")] | ||
| [string]$Configuration = "Release", | ||
| [ValidateRange(1, 4)] | ||
| [int]$ChildBudget = [Math]::Min([Environment]::ProcessorCount, 4), | ||
| [ValidateRange(1, 2)] | ||
| [int]$MaximumParallelModules = 2, | ||
| [string]$ResultsDirectory, | ||
| [switch]$DisablePackageCacheReuse | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
| . (Join-Path $PSScriptRoot "collection-test-modules.ps1") | ||
| . (Join-Path $PSScriptRoot "collection-module-pool.ps1") | ||
|
|
||
| $Repository = [System.IO.Path]::GetFullPath($Repository) | ||
| $globalJson = Get-Content -LiteralPath (Join-Path $Repository "global.json") -Raw | ConvertFrom-Json | ||
| $concurrency = Get-CollectionModuleConcurrency -ConfiguredBatches $globalJson.test.affectedTests.maximumConcurrentBatches ` | ||
| -ChildBudget $ChildBudget -MaximumParallelModules $MaximumParallelModules | ||
| $batchesPerModule = $concurrency.BatchesPerModule | ||
| $effectiveBudget = $concurrency.ChildBudget | ||
| $slots = $concurrency.MaximumParallelModules | ||
| $modules = @(Get-OrderedCollectionModule -Modules @(Get-CTSComparisonModule -Repository $Repository -Configuration $Configuration)) | ||
| $dotnetPath = (Get-Command dotnet -CommandType Application | Select-Object -First 1).Source | ||
| $resultsRoot = if ([string]::IsNullOrEmpty($ResultsDirectory)) { | ||
| Join-Path -Path $Repository -ChildPath "artifacts" -AdditionalChildPath @("TestResults", $Configuration, "AffectedCollection") | ||
| } else { | ||
| [System.IO.Path]::GetFullPath($ResultsDirectory) | ||
| } | ||
| $resultsDirectory = Join-Path $resultsRoot ([guid]::NewGuid().ToString("N")) | ||
| Write-Host "Collecting $($modules.Count) modules with $slots SDK slots and at most $($slots * $batchesPerModule) instrumentation children." | ||
| $timer = [System.Diagnostics.Stopwatch]::StartNew() | ||
| $sourceRevision = & git -C $Repository rev-parse HEAD | ||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "Could not read the collection source revision." | ||
| } | ||
|
|
||
| $result = $null | ||
| $packageCacheRoot = if ($DisablePackageCacheReuse) { | ||
| $null | ||
| } else { | ||
| Join-Path -Path $Repository -ChildPath "artifacts" -AdditionalChildPath @("tmp", $Configuration, "collection-cache", [guid]::NewGuid().ToString("N")) | ||
| } | ||
| try { | ||
| $result = Invoke-CollectionModulePool -Modules $modules -Repository $Repository -ResultsDirectory $resultsDirectory ` | ||
| -DotnetPath $dotnetPath -MaximumParallelModules $slots -PackageCacheRoot $packageCacheRoot | ||
| } finally { | ||
| $timer.Stop() | ||
| $metadataError = $null | ||
| try { | ||
| @{ | ||
| SourceRevision = $sourceRevision | ||
| ChildBudget = $effectiveBudget | ||
| BatchesPerModule = $batchesPerModule | ||
| PackageCacheReuse = -not $DisablePackageCacheReuse | ||
| DurationSeconds = $timer.Elapsed.TotalSeconds | ||
| Result = $result | ||
| CompletedNormally = $null -ne $result | ||
| } | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath (Join-Path $resultsDirectory "collection.json") -Encoding utf8 | ||
| } catch { | ||
| $metadataError = $_ | ||
| Write-Warning "Could not write collection metadata: $($_.Exception.Message)" | ||
| } | ||
| if ($null -ne $result -and $result.TeardownConfirmed -and $null -ne $packageCacheRoot -and (Test-Path -LiteralPath $packageCacheRoot)) { | ||
| try { | ||
| Remove-Item -LiteralPath $packageCacheRoot -Recurse -Force | ||
| } catch { | ||
| if ($result.ExitCode -eq 0) { | ||
| throw | ||
| } | ||
| Write-Warning "Collection failed with exit $($result.ExitCode); owned cache cleanup also failed: $($_.Exception.Message)" | ||
| } | ||
| } elseif ($null -ne $packageCacheRoot -and (Test-Path -LiteralPath $packageCacheRoot)) { | ||
| Write-Warning "Collection failed before confirming child teardown. Preserving the owned cache '$packageCacheRoot' for diagnosis." | ||
| } | ||
| if ($null -ne $metadataError -and $null -ne $result -and $result.ExitCode -eq 0) { | ||
| throw $metadataError | ||
| } | ||
| } | ||
| Write-Host "Collection finished: $($result.Completed)/$($result.Planned) modules, exit $($result.ExitCode), duration $($timer.Elapsed)." | ||
| exit $result.ExitCode | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.