Skip to content

Commit e690954

Browse files
committed
desktop 4 batches
1 parent 9b4a7ce commit e690954

File tree

3 files changed

+110
-6
lines changed

3 files changed

+110
-6
lines changed

azure-pipelines-PR.yml

+92-6
Original file line numberDiff line numberDiff line change
@@ -306,18 +306,29 @@ stages:
306306
name: $(DncEngPublicBuildPool)
307307
demands: ImageOverride -equals $(WindowsMachineQueueName)
308308
timeoutInMinutes: 120
309+
strategy:
310+
parallel: 4
309311
steps:
310312
- checkout: self
311313
clean: true
312314

313-
- script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testDesktop -configuration Release
315+
- script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testDesktop -configuration Release -job $(System.JobPositionInPhase)
314316
env:
315317
DOTNET_DbgEnableMiniDump: 1
316318
DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing.
317319
DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\Release\$(Build.BuildId)-%e-%p-%t.dmp
318320
NativeToolsOnMachine: true
319321
displayName: Build
320322

323+
- task: PublishTestResults@2
324+
displayName: Publish Test Results
325+
inputs:
326+
testResultsFormat: 'XUnit'
327+
testRunTitle: WindowsNoRealsig_testDesktop $(System.JobPositionInPhase)
328+
mergeTestResults: true
329+
testResultsFiles: '*.xml'
330+
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
331+
continueOnError: true
321332
- task: PublishBuildArtifacts@1
322333
displayName: Publish Build BinLog
323334
condition: always()
@@ -333,7 +344,7 @@ stages:
333344
continueOnError: true
334345
inputs:
335346
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\Release'
336-
ArtifactName: 'Windows Release WindowsNoRealsig_testDesktop process dumps'
347+
ArtifactName: 'Windows Release WindowsNoRealsig_testDesktop process dumps $(System.JobPositionInPhase)'
337348
ArtifactType: Container
338349
parallel: true
339350

@@ -429,11 +440,8 @@ stages:
429440
demands: ImageOverride -equals $(WindowsMachineQueueName)
430441
timeoutInMinutes: 120
431442
strategy:
432-
maxParallel: 5
443+
maxParallel: 4
433444
matrix:
434-
desktop_release:
435-
_configuration: Release
436-
_testKind: testDesktop
437445
coreclr_release:
438446
_configuration: Release
439447
_testKind: testCoreclr
@@ -537,6 +545,84 @@ stages:
537545
continueOnError: true
538546
condition: failed()
539547

548+
# Windows With Compressed Metadata Desktop
549+
- job: WindowsCompressedMetadata
550+
variables:
551+
- name: XUNIT_LOGS
552+
value: $(Build.SourcesDirectory)\artifacts\TestResults\Release
553+
- name: __VSNeverShowWhatsNew
554+
value: 1
555+
pool:
556+
# The PR build definition sets this variable:
557+
# WindowsMachineQueueName=Windows.vs2022.amd64.open
558+
# and there is an alternate build definition that sets this to a queue that is always scouting the
559+
# next preview of Visual Studio.
560+
name: $(DncEngPublicBuildPool)
561+
demands: ImageOverride -equals $(WindowsMachineQueueName)
562+
timeoutInMinutes: 120
563+
strategy:
564+
parallel: 4
565+
566+
steps:
567+
- checkout: self
568+
clean: true
569+
570+
- script: eng\CIBuild.cmd -compressallmetadata -configuration Release -testDesktop -job $(System.JobPositionInPhase)
571+
env:
572+
DOTNET_DbgEnableMiniDump: 1
573+
DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing.
574+
DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\Release\$(Build.BuildId)-%e-%p-%t.dmp
575+
NativeToolsOnMachine: true
576+
displayName: Build / Test
577+
578+
- task: PublishTestResults@2
579+
displayName: Publish Test Results
580+
inputs:
581+
testResultsFormat: 'XUnit'
582+
testRunTitle: WindowsCompressedMetadata testDesktop $(System.JobPositionInPhase)
583+
mergeTestResults: true
584+
testResultsFiles: '*.xml'
585+
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
586+
continueOnError: true
587+
588+
- task: PublishBuildArtifacts@1
589+
displayName: Publish Tests BinLog
590+
condition: always()
591+
continueOnError: true
592+
inputs:
593+
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog'
594+
ArtifactName: 'Windows testDesktop test binlogs'
595+
ArtifactType: Container
596+
parallel: true
597+
- task: PublishBuildArtifacts@1
598+
displayName: Publish Dumps
599+
condition: failed()
600+
continueOnError: true
601+
inputs:
602+
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\Release'
603+
ArtifactName: 'Windows testDesktop process dumps $(System.JobPositionInPhase)'
604+
ArtifactType: Container
605+
parallel: true
606+
- task: PublishBuildArtifacts@1
607+
displayName: Publish Test Logs
608+
inputs:
609+
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults\Release'
610+
ArtifactName: 'Windows testDesktop test logs $(System.JobPositionInPhase)'
611+
publishLocation: Container
612+
continueOnError: true
613+
condition: always()
614+
- script: dotnet build $(Build.SourcesDirectory)/eng/DumpPackageRoot/DumpPackageRoot.csproj
615+
displayName: Dump NuGet cache contents
616+
condition: failed()
617+
- task: PublishBuildArtifacts@1
618+
displayName: Publish NuGet cache contents
619+
inputs:
620+
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\NugetPackageRootContents'
621+
ArtifactName: 'NuGetPackageContents Windows testDesktop'
622+
publishLocation: Container
623+
continueOnError: true
624+
condition: failed()
625+
540626
# Mock official build
541627
- job: MockOfficial
542628
pool:

eng/Build.ps1

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ param (
7373
[switch]$compressAllMetadata,
7474
[switch]$buildnorealsig = $true,
7575
[switch]$verifypackageshipstatus = $false,
76+
[string]$job = "",
7677
[parameter(ValueFromRemainingArguments = $true)][string[]]$properties)
7778

7879
Set-StrictMode -version 2.0
@@ -357,6 +358,10 @@ function VerifyAssemblyVersionsAndSymbols() {
357358
}
358359

359360
function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false, [string] $settings = "") {
361+
if ($job) {
362+
Write-Host("Testing batch: $job")
363+
$filter = ""
364+
}
360365
$dotnetPath = InitializeDotNetCli
361366
$dotnetExe = Join-Path $dotnetPath "dotnet.exe"
362367
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
@@ -376,6 +381,9 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
376381
}
377382

378383
$args += " $settings"
384+
if ($job) {
385+
$args += " --filter batch=$job"
386+
}
379387

380388
if ($asBackgroundJob) {
381389
Write-Host

tests/FSharp.Test.Utilities/XunitHelpers.fs

+10
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ module TestCaseCustomizations =
9090
else
9191
testCase.TestMethod
9292

93+
let sha = Security.Cryptography.SHA256.Create()
94+
95+
let addBatchTrait (testCase: ITestCase) =
96+
let data = Text.Encoding.UTF8.GetBytes testCase.UniqueID
97+
let hashCode = BitConverter.ToUInt32(sha.ComputeHash(data), 0)
98+
let batch = hashCode % 4u + 1u
99+
testCase.Traits.Add("batch", ResizeArray [ string batch ])
100+
93101
type CustomTestCase =
94102
inherit XunitTestCase
95103
// xUinit demands this constructor for deserialization.
@@ -109,6 +117,7 @@ type CustomTestCase =
109117
override testCase.Initialize () =
110118
base.Initialize()
111119
testCase.TestMethod <- TestCaseCustomizations.rewriteTestMethod testCase
120+
TestCaseCustomizations.addBatchTrait testCase
112121

113122
type CustomTheoryTestCase =
114123
inherit XunitTheoryTestCase
@@ -127,6 +136,7 @@ type CustomTheoryTestCase =
127136
override testCase.Initialize () =
128137
base.Initialize()
129138
testCase.TestMethod <- TestCaseCustomizations.rewriteTestMethod testCase
139+
TestCaseCustomizations.addBatchTrait testCase
130140

131141
#endif
132142

0 commit comments

Comments
 (0)