Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 47 additions & 104 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFormat: 'XUnit'
testRunTitle: WindowsNoRealsig_testCoreclr
mergeTestResults: true
testResultsFiles: '*.trx'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
condition: succeededOrFailed()

Expand Down Expand Up @@ -317,10 +317,10 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFormat: 'XUnit'
testRunTitle: WindowsNoRealsig_testDesktop
mergeTestResults: true
testResultsFiles: '*.trx'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
condition: succeededOrFailed()
continueOnError: true
Expand Down Expand Up @@ -465,10 +465,10 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFormat: 'XUnit'
testRunTitle: WindowsCompressedMetadata $(_testKind) $(transparentCompiler)
mergeTestResults: true
testResultsFiles: '*.trx'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)'
continueOnError: true
condition: succeededOrFailed()
Expand Down Expand Up @@ -510,8 +510,16 @@ stages:
continueOnError: true
condition: failed()

# Windows With Compressed Metadata Desktop
# Windows With Compressed Metadata Desktop (split into 3 batches)
- job: WindowsCompressedMetadata_Desktop
strategy:
matrix:
Batch1:
batchNumber: 1
Batch2:
batchNumber: 2
Batch3:
batchNumber: 3
variables:
- name: XUNIT_LOGS
value: $(Build.SourcesDirectory)\artifacts\TestResults\Release
Expand All @@ -523,65 +531,20 @@ stages:
timeoutInMinutes: 120

steps:
- checkout: self
clean: true

- script: eng\CIBuildNoPublish.cmd -compressallmetadata -configuration Release -testDesktop
env:
FSharp_CacheEvictionImmediate: true
DOTNET_DbgEnableMiniDump: 1
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.
DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\Release\$(Build.BuildId)-%e-%p-%t.dmp
NativeToolsOnMachine: true
displayName: Build / Test

- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testRunTitle: WindowsCompressedMetadata testDesktop
mergeTestResults: true
testResultsFiles: '*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/Release'
continueOnError: true
condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
displayName: Publish BinLog
continueOnError: true
inputs:
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog'
ArtifactName: 'Windows testDesktop binlogs'
ArtifactType: Container
parallel: true
- task: PublishBuildArtifacts@1
displayName: Publish Dumps
condition: failed()
continueOnError: true
inputs:
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\Release'
ArtifactName: 'Windows testDesktop process dumps'
ArtifactType: Container
parallel: true
- task: PublishBuildArtifacts@1
displayName: Publish Test Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults\Release'
ArtifactName: 'Windows testDesktop test logs'
publishLocation: Container
continueOnError: true
condition: always()
- script: dotnet build $(Build.SourcesDirectory)/eng/DumpPackageRoot/DumpPackageRoot.csproj
displayName: Dump NuGet cache contents
condition: failed()
- task: PublishBuildArtifacts@1
displayName: Publish NuGet cache contents
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\NugetPackageRootContents'
ArtifactName: 'NuGetPackageContents Windows testDesktop'
publishLocation: Container
continueOnError: true
condition: failed()
- template: /eng/templates/batched-test-steps.yml
parameters:
buildCommand: eng\CIBuildNoPublish.cmd -compressallmetadata -configuration Release -testDesktopBatch $(batchNumber)
buildEnv:
FSharp_CacheEvictionImmediate: true
DOTNET_DbgEnableMiniDump: 1
DOTNET_DbgMiniDumpType: 3
DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\Release\$(Build.BuildId)-%e-%p-%t.dmp
NativeToolsOnMachine: true
testRunTitlePrefix: 'WindowsCompressedMetadata testDesktop'
artifactNamePrefix: 'Windows testDesktop'
publishBinLog: true
binLogPath: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog'
publishDumps: true

# Mock official build
- job: MockOfficial
Expand Down Expand Up @@ -611,9 +574,9 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFormat: 'XUnit'
testRunTitle: Linux
testResultsFiles: '*.trx'
testResultsFiles: '*.xml'
mergeTestResults: true
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
Expand All @@ -638,50 +601,30 @@ stages:
continueOnError: true
condition: failed()

# MacOS
# MacOS (split into 3 batches)
- job: MacOS
strategy:
matrix:
Batch1:
batchNumber: 1
Batch2:
batchNumber: 2
Batch3:
batchNumber: 3
pool:
vmImage: macos-latest
timeoutInMinutes: 120
variables:
- name: _SignType
value: Test
steps:
- checkout: self
clean: true
- script: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclr
env:
COMPlus_DefaultStackSize: 1000000
displayName: Build / Test
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '*.trx'
testRunTitle: MacOS
mergeTestResults: true
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Test Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
ArtifactName: 'MacOS $(_BuildConfig) test logs'
publishLocation: Container
continueOnError: true
condition: failed()
- script: dotnet build $(Build.SourcesDirectory)/eng/DumpPackageRoot/DumpPackageRoot.csproj
displayName: Dump NuGet cache contents
condition: failed()
- task: PublishBuildArtifacts@1
displayName: Publish NuGet cache contents
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/NugetPackageRootContents'
ArtifactName: 'NuGetPackageContents Mac'
publishLocation: Container
continueOnError: true
condition: failed()
- template: /eng/templates/batched-test-steps.yml
parameters:
buildCommand: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclrbatch $(batchNumber)
buildEnv:
COMPlus_DefaultStackSize: 1000000
testRunTitlePrefix: 'MacOS'
artifactNamePrefix: 'MacOS'

# End to end build
- job: EndToEndBuildTests
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ extends:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '*.trx'
testResultsFormat: 'XUnit'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
condition: ne(variables['SkipTests'], 'true')
Expand Down
36 changes: 27 additions & 9 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ param (
[switch]$dontUseGlobalNuGetCache = $false,
[switch]$warnAsError = $true,
[switch][Alias('test')]$testDesktop,
[string]$testDesktopBatch = "",
[switch]$testCoreClr,
[switch]$testCambridge,
[switch]$testCompiler,
Expand Down Expand Up @@ -121,6 +122,7 @@ function Print-Usage() {
Write-Host " -testCompilerService Run FSharpCompilerService unit tests"
Write-Host " -testCompilerComponentTests Run FSharpCompilerService component tests"
Write-Host " -testDesktop Run tests against full .NET Framework"
Write-Host " -testDesktopBatch <1|2|3> Run a specific batch of the desktop test split (implies -testDesktop)"
Write-Host " -testCoreClr Run tests against CoreCLR"
Write-Host " -testFSharpCore Run FSharpCore unit tests"
Write-Host " -testIntegration Run F# integration tests"
Expand Down Expand Up @@ -193,6 +195,10 @@ function Process-Arguments() {
$script:testEditor = $True
}

if ($script:testDesktopBatch -ne "") {
$script:testDesktop = $True
}

if ([System.Boolean]::Parse($script:officialSkipTests)) {
$script:testAll = $False
$script:testAllButIntegration = $False
Expand Down Expand Up @@ -374,14 +380,10 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
# MTP requires --solution flag for .sln files
$testTarget = if ($testProject.EndsWith('.sln')) { "--solution ""$testProject""" } else { "--project ""$testProject""" }

# For solutions, omit --report-xunit-trx-filename so each test assembly generates a unique .trx file.
# With a static filename, all assemblies overwrite the same file and only the last one's results survive.
if ($testProject.EndsWith('.sln')) {
$reportArgs = "--report-xunit-trx"
} else {
$testLogFileName = "${projectName}_${targetFramework}.trx"
$reportArgs = "--report-xunit-trx --report-xunit-trx-filename ""$testLogFileName"""
}
# Xunit XML report via XunitXml.TestLogger with CI-friendly filenames
$jobName = if ($env:SYSTEM_JOBNAME) { $env:SYSTEM_JOBNAME } else { "local" }
$xunitLogFileName = "{assembly}.{framework}.${jobName}.xml"
$reportArgs = "--report-spekt-xunit --report-spekt-xunit-filename ""$xunitLogFileName"""

$test_args = "test $testTarget -c $configuration -f $targetFramework $reportArgs --results-directory ""$testResultsDir"" /bl:$testBinLogPath"
# MTP HangDump extension replaces VSTest --blame-hang-timeout
Expand Down Expand Up @@ -605,7 +607,23 @@ try {
}

if ($testDesktop) {
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:desktopTargetFramework
if ($testDesktopBatch -ne "") {
$dotnetPath = InitializeDotNetCli
$dotnetExe = Join-Path $dotnetPath "dotnet.exe"
$splitScript = Join-Path $RepoRoot "eng\tests\TestSplit.fsx"
$splitOutput = & $dotnetExe fsi $splitScript $testDesktopBatch desktop
if ($LASTEXITCODE -ne 0) { throw "TestSplit.fsx failed with exit code $LASTEXITCODE" }
foreach ($line in $splitOutput) {
if ($line -match '^dotnet test (\S+) --no-build -c Release\s*(.*)$') {
$proj = $Matches[1] -replace '/', '\'
$projPath = Join-Path $RepoRoot $proj
$settings = $Matches[2].Trim()
TestUsingMSBuild -testProject $projPath -targetFramework $script:desktopTargetFramework -settings $settings
}
}
} else {
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:desktopTargetFramework
}
}

if ($testFSharpCore) {
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
<XunitVersion>3.2.2</XunitVersion>
<XunitRunnerConsoleVersion>3.2.2</XunitRunnerConsoleVersion>
<XunitXmlTestLoggerVersion>8.0.0</XunitXmlTestLoggerVersion>
<!-- -->
</PropertyGroup>

Expand Down
46 changes: 34 additions & 12 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pack=false
publish=false
sign=false
test_core_clr=false
test_core_clr_batch=""
test_compilercomponent_tests=false
test_benchmarks=false
test_scripting=false
Expand Down Expand Up @@ -142,6 +143,11 @@ while [[ $# > 0 ]]; do
--testcoreclr|--test|-t)
test_core_clr=true
;;
--testcoreclrbatch)
test_core_clr=true
test_core_clr_batch=$2
shift
;;
--testcompilercomponenttests)
test_compilercomponent_tests=true
;;
Expand Down Expand Up @@ -204,6 +210,7 @@ function Test() {
BuildMessage="Error running tests"
testproject=""
targetframework=""
extraargs=""
while [[ $# > 0 ]]; do
opt="$(echo "$1" | awk '{print tolower($0)}')"
case "$opt" in
Expand All @@ -215,6 +222,10 @@ function Test() {
targetframework=$2
shift
;;
--extraargs)
extraargs=$2
shift
;;
*)
echo "Invalid argument: $1"
exit 1
Expand All @@ -233,18 +244,18 @@ function Test() {
testresultsdir="$artifacts_dir/TestResults/$configuration"

# MTP requires --solution flag for .sln files
# For solutions, omit --report-xunit-trx-filename so each test assembly generates a unique .trx file.
# With a static filename, all assemblies overwrite the same file and only the last one's results survive.
if [[ "$testproject" == *.sln ]]; then
testtarget="--solution"
reportargs="--report-xunit-trx"
else
testtarget="--project"
testlogfilename="${projectname}_${targetframework}.trx"
reportargs="--report-xunit-trx --report-xunit-trx-filename $testlogfilename"
fi

args=(test $testtarget "$testproject" --no-build -c "$configuration" -f "$targetframework" $reportargs --results-directory "$testresultsdir" --hangdump --hangdump-timeout 5m --hangdump-type Full)
# Xunit XML report via XunitXml.TestLogger with CI-friendly filenames
jobname="${SYSTEM_JOBNAME:-local}"
xunitlogfilename="{assembly}.{framework}.${jobname}.xml"
reportargs="--report-spekt-xunit --report-spekt-xunit-filename $xunitlogfilename"

args=(test $testtarget "$testproject" --no-build -c "$configuration" -f "$targetframework" $reportargs --results-directory "$testresultsdir" --hangdump --hangdump-timeout 5m --hangdump-type Full $extraargs)

"$DOTNET_INSTALL_DIR/dotnet" "${args[@]}" || exit $?
}
Expand Down Expand Up @@ -362,12 +373,23 @@ BuildSolution

if [[ "$test_core_clr" == true ]]; then
coreclrtestframework=$tfm
# Note: FSharp.Test.Utilities is a utility library, not a test project. Its tests are disabled due to xUnit3 API incompatibilities.
Test --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclrtestframework

if [[ "$test_core_clr_batch" != "" ]]; then
# Run batched: use TestSplit.fsx to get the commands for this batch
while IFS= read -r line; do
# Extract project path and extra filter args from each line
project=$(echo "$line" | sed 's/^dotnet test //' | sed 's/ --no-build.*//')
filterargs=$(echo "$line" | sed 's/^dotnet test [^ ]* --no-build -c Release *//')
Test --testproject "$repo_root/$project" --targetframework $coreclrtestframework --extraargs "$filterargs"
done < <("$DOTNET_INSTALL_DIR/dotnet" fsi "$scriptroot/tests/TestSplit.fsx" "$test_core_clr_batch" coreclr)
else
# Run all tests without batching
Test --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework
Test --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclrtestframework
fi
fi

if [[ "$test_compilercomponent_tests" == true ]]; then
Expand Down
Loading
Loading