Skip to content

Commit edadeec

Browse files
committed
testbatch
1 parent 6531545 commit edadeec

File tree

3 files changed

+58
-69
lines changed

3 files changed

+58
-69
lines changed

azure-pipelines-PR.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ stages:
312312
- checkout: self
313313
clean: true
314314

315-
- script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testDesktop -configuration Release -job $(System.JobPositionInPhase)
315+
- script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testDesktop -configuration Release -testBatch $(System.JobPositionInPhase)
316316
env:
317317
DOTNET_DbgEnableMiniDump: 1
318318
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.
@@ -324,7 +324,7 @@ stages:
324324
displayName: Publish Test Results
325325
inputs:
326326
testResultsFormat: 'XUnit'
327-
testRunTitle: WindowsNoRealsig_testDesktop $(System.JobPositionInPhase)
327+
testRunTitle: WindowsNoRealsig_testDesktop batch $(System.JobPositionInPhase)
328328
mergeTestResults: true
329329
testResultsFiles: '*.xml'
330330
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
@@ -567,7 +567,7 @@ stages:
567567
- checkout: self
568568
clean: true
569569

570-
- script: eng\CIBuild.cmd -compressallmetadata -configuration Release -testDesktop -job $(System.JobPositionInPhase)
570+
- script: eng\CIBuild.cmd -compressallmetadata -configuration Release -testDesktop -testBatch $(System.JobPositionInPhase)
571571
env:
572572
DOTNET_DbgEnableMiniDump: 1
573573
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.
@@ -579,7 +579,7 @@ stages:
579579
displayName: Publish Test Results
580580
inputs:
581581
testResultsFormat: 'XUnit'
582-
testRunTitle: WindowsCompressedMetadata testDesktop $(System.JobPositionInPhase)
582+
testRunTitle: WindowsCompressedMetadata testDesktop batch $(System.JobPositionInPhase)
583583
mergeTestResults: true
584584
testResultsFiles: '*.xml'
585585
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
@@ -607,7 +607,7 @@ stages:
607607
displayName: Publish Test Logs
608608
inputs:
609609
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults\Release'
610-
ArtifactName: 'Windows testDesktop test logs $(System.JobPositionInPhase)'
610+
ArtifactName: 'Windows testDesktop test logs batch $(System.JobPositionInPhase)'
611611
publishLocation: Container
612612
continueOnError: true
613613
condition: always()
@@ -647,13 +647,13 @@ stages:
647647
steps:
648648
- checkout: self
649649
clean: true
650-
- script: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclr -job $(System.JobPositionInPhase)
651-
displayName: Build / Test -job $(System.JobPositionInPhase)
650+
- script: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclr --testbatch $(System.JobPositionInPhase)
651+
displayName: Build / Test batch $(System.JobPositionInPhase)
652652
- task: PublishTestResults@2
653653
displayName: Publish Test Results
654654
inputs:
655655
testResultsFormat: 'XUnit'
656-
testRunTitle: Linux -job $(System.JobPositionInPhase)
656+
testRunTitle: Linux -testBatch $(System.JobPositionInPhase)
657657
testResultsFiles: '*.xml'
658658
mergeTestResults: true
659659
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
@@ -663,7 +663,7 @@ stages:
663663
displayName: Publish Test Logs
664664
inputs:
665665
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
666-
ArtifactName: 'Linux $(_BuildConfig) test logs -job $(System.JobPositionInPhase)'
666+
ArtifactName: 'Linux $(_BuildConfig) test logs batch $(System.JobPositionInPhase)'
667667
publishLocation: Container
668668
continueOnError: true
669669
condition: failed()
@@ -674,7 +674,7 @@ stages:
674674
displayName: Publish NuGet cache contents
675675
inputs:
676676
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/NugetPackageRootContents'
677-
ArtifactName: 'NuGetPackageContents Linux -job $(System.JobPositionInPhase)'
677+
ArtifactName: 'NuGetPackageContents Linux -batch $(System.JobPositionInPhase)'
678678
publishLocation: Container
679679
continueOnError: true
680680
condition: failed()

eng/Build.ps1

+37-52
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ param (
7373
[switch]$compressAllMetadata,
7474
[switch]$buildnorealsig = $true,
7575
[switch]$verifypackageshipstatus = $false,
76-
[string]$job = "",
76+
[string]$testBatch = "",
7777
[parameter(ValueFromRemainingArguments = $true)][string[]]$properties)
7878

7979
Set-StrictMode -version 2.0
@@ -357,17 +357,24 @@ function VerifyAssemblyVersionsAndSymbols() {
357357
}
358358
}
359359

360-
function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false, [string] $settings = "") {
360+
function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string] $settings = "") {
361361

362362
$dotnetPath = InitializeDotNetCli
363363
$dotnetExe = Join-Path $dotnetPath "dotnet.exe"
364364
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
365+
366+
$testBatchSuffix = ""
367+
if ($testBatch) {
368+
$testBatchSuffix = "_batch$testBatch"
369+
}
370+
365371
# {assembly} and {framework} will expand respectively. See https://github.com/spekt/testlogger/wiki/Logger-Configuration#logfilepath
366372
# This is useful to deconflict log filenames when there are many test assemblies, e.g. when testing a whole solution.
367-
$testLogPath = "$ArtifactsDir\TestResults\$configuration\{assembly}_{framework}$job.xml"
368-
$testBinLogPath = "$LogDir\${projectName}_$targetFramework$job.binlog"
369-
$args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""xunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
370-
$args += " --blame --blame-hang-timeout 5minutes --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=true"
373+
$testLogPath = "$ArtifactsDir\TestResults\$configuration\{assembly}_{framework}$testBatchSuffix.xml"
374+
375+
$testBinLogPath = "$LogDir\${projectName}_$targetFramework$testBatch.binlog"
376+
$args = "test $testProject -c $configuration -f $targetFramework --logger ""xunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
377+
$args += " --blame-hang-timeout 5minutes --results-directory $ArtifactsDir\TestResults\$configuration"
371378

372379
if (-not $noVisualStudio -or $norestore) {
373380
$args += " --no-restore"
@@ -378,25 +385,12 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
378385
}
379386

380387
$args += " $settings"
381-
if ($job) {
382-
$args += " --filter batch=$job"
383-
}
384-
385-
if ($asBackgroundJob) {
386-
Write-Host
387-
Write-Host("Starting on the background: $args")
388-
Write-Host("------------------------------------")
389-
Start-Job -ScriptBlock {
390-
$argArray = $using:args -Split " "
391-
& $using:dotnetExe $argArray
392-
if ($LASTEXITCODE -ne 0) {
393-
throw "Command failed to execute with exit code $($LASTEXITCODE): $using:dotnetExe $using:args"
394-
}
395-
}
396-
} else {
397-
Write-Host("$args")
398-
Exec-Console $dotnetExe $args
388+
if ($testBatch) {
389+
$args += " --filter batch=$testBatch"
399390
}
391+
392+
Write-Host("$args")
393+
Exec-Console $dotnetExe $args
400394
}
401395

402396
function Prepare-TempDir() {
@@ -600,20 +594,12 @@ try {
600594
$script:BuildCategory = "Test"
601595
$script:BuildMessage = "Failure running tests"
602596

603-
function Receive($job) {
604-
while($job.HasMoreData) {
605-
Receive-Job $job | Write-Host
606-
Start-Sleep -Seconds 1
607-
}
608-
Receive-Job $job -Wait -ErrorAction Stop
609-
}
610-
611597
if ($testCoreClr) {
612-
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
598+
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:coreclrTargetFramework
613599
}
614600

615601
if ($testDesktop) {
616-
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
602+
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:desktopTargetFramework
617603
}
618604

619605
if ($testFSharpQA) {
@@ -644,50 +630,49 @@ try {
644630
}
645631

646632
if ($testFSharpCore) {
647-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
648-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
633+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework
634+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework
649635
}
650636

651637
if ($testCompiler) {
652-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
653-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
654-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
655-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
638+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework
639+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework
640+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework
641+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework
656642
}
657643

658644

659645
if ($testCompilerComponentTests) {
660-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
661-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
646+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework
647+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework
662648
}
663649

664650

665651
if ($testCompilerService) {
666-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
667-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
652+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework
653+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework
668654
}
669655

670656
if ($testCambridge) {
671-
TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\"
672-
TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\"
657+
TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework
658+
TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework
673659
}
674660

675661
if ($testScripting) {
676-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
677-
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
662+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework
663+
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework
678664
}
679665

680666
if ($testEditor -and -not $noVisualStudio) {
681-
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj"
667+
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework
682668
}
683669

684670
if ($testVs -and -not $noVisualStudio) {
685-
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\"
671+
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework
686672
}
687673

688-
689674
if ($testIntegration) {
690-
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\"
675+
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework
691676
}
692677

693678
if ($testAOT) {

eng/build.sh

+11-7
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ prepare_machine=false
7676
source_build=false
7777
product_build=false
7878
buildnorealsig=true
79-
job=""
79+
testbatch=""
8080
properties=""
8181

8282
docker=false
@@ -105,8 +105,8 @@ while [[ $# > 0 ]]; do
105105
args="$args $1"
106106
shift
107107
;;
108-
--job|-job)
109-
job=$2
108+
--testbatch)
109+
testbatch=$2
110110
args="$args $1"
111111
shift
112112
;;
@@ -230,11 +230,15 @@ function Test() {
230230

231231
projectname=$(basename -- "$testproject")
232232
projectname="${projectname%.*}"
233-
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework$job.xml"
234-
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame-hang-timeout 5minutes --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
233+
testbatchsuffix=""
234+
if [[ "$testbatch" != "" ]]; then
235+
testbatchsuffix="_batch$testbatch"
236+
fi
237+
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework$testbatchsuffix.xml"
238+
args="test \"$testproject\" --no-build -c $configuration -f $targetframework --logger \"xunit;LogFilePath=$testlogpath\" --blame-hang-timeout 5minutes --results-directory $artifacts_dir/TestResults/$configuration"
235239

236-
if [[ "$job" != "" ]]; then
237-
args="$args --filter batch=$job"
240+
if [[ "$testbatch" != "" ]]; then
241+
args="$args --filter batch=$testbatch"
238242
fi
239243

240244
"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?

0 commit comments

Comments
 (0)