Skip to content
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

Add and utilize -testBenchmark build option #16600

Merged
merged 4 commits into from
Jan 29, 2024
Merged
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
4 changes: 0 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
</PropertyGroup>

<PropertyGroup Condition="'$(SolutionName)' == 'FSharp.Benchmarks' and '$(BUILDING_USING_DOTNET)' != 'false'">
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
</PropertyGroup>

<!-- Temporary workaround if proj-info is used, allows Ionide's evaluation to work correctly. -->
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' != 'false' and '$(DotnetProjInfo)' == 'true'">
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
Expand Down
21 changes: 3 additions & 18 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CI and PR triggers
# CI and PR triggers
trigger:
branches:
include:
Expand Down Expand Up @@ -724,25 +724,10 @@ stages:
steps:
- checkout: self
clean: true
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
useGlobalJson: true
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet build -c $(_BuildConfig) .\FSharp.Benchmarks.sln /bl:\"artifacts/log/$(_BuildConfig)/BenchmarkBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)
displayName: Plain build of FSharp.Benchmarks.sln
- script: eng\CIBuild.cmd -testBenchmarks
displayName: Smoke test fast benchmarks
continueOnError: true
condition: always()
- script: .\Build.cmd -c $(_BuildConfig)
- pwsh: ./SmokeTestBenchmarks.ps1
workingDirectory: $(Build.SourcesDirectory)/tests/benchmarks
displayName: Smoke test fast benchmarks

# Test trimming on Windows
- job: Build_And_Test_Trimming_Windows
Expand Down
24 changes: 23 additions & 1 deletion eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ param (
[switch]$testAllButIntegration,
[switch]$testpack,
[switch]$testAOT,
[switch]$testBenchmarks,
[string]$officialSkipTests = "false",
[switch]$noVisualStudio,
[switch]$sourceBuild,
Expand Down Expand Up @@ -111,6 +112,7 @@ function Print-Usage() {
Write-Host " -testVs Run F# editor unit tests"
Write-Host " -testpack Verify built packages"
Write-Host " -testAOT Run AOT/Trimming tests"
Write-Host " -testBenchmarks Build and Run Benchmark suite"
Write-Host " -officialSkipTests <bool> Set to 'true' to skip running tests"
Write-Host ""
Write-Host "Advanced settings:"
Expand Down Expand Up @@ -176,6 +178,7 @@ function Process-Arguments() {
$script:testVs = $False
$script:testpack = $False
$script:testAOT = $False
$script:testBenchmarks = $False
$script:verifypackageshipstatus = $True
}

Expand Down Expand Up @@ -211,6 +214,10 @@ function Process-Arguments() {
$script:pack = $True;
}

if ($testBenchmarks) {
$script:testBenchmarks = $True
}

foreach ($property in $properties) {
if (!$property.StartsWith("/p:", "InvariantCultureIgnoreCase")) {
Write-Host "Invalid argument: $property"
Expand Down Expand Up @@ -339,7 +346,7 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str

if ($env:RunningAsPullRequest -ne "true" -and $noTestFilter -eq $false) {
$args += " --filter TestCategory!=PullRequest"
}
}`

if ($asBackgroundJob) {
Write-Host("Starting on the background: $args")
Expand Down Expand Up @@ -541,12 +548,21 @@ try {
}
}

if ($testBenchmarks) {
$properties_storage = $properties
$properties += "/p:RuntimeIdentifier=win-x64"
$properties += "/p:Configuration=Release" # Always run in release.
BuildSolution "FSharp.Benchmarks.sln" $False
$properties = $properties_storage
}

if ($pack) {
$properties_storage = $properties
$properties += "/p:GenerateSbom=false"
BuildSolution "Microsoft.FSharp.Compiler.sln" $True
$properties = $properties_storage
}

if ($build) {
VerifyAssemblyVersionsAndSymbols
}
Expand Down Expand Up @@ -662,6 +678,12 @@ try {
Pop-Location
}

if ($testBenchmarks) {
Push-Location "$RepoRoot\tests\benchmarks"
./SmokeTestBenchmarks.ps1
Pop-Location
}

# verify nupkgs have access to the source code
$nupkgtestFailed = $false
if ($testpack) {
Expand Down
Loading