Skip to content
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
2 changes: 1 addition & 1 deletion tests/AheadOfTime/NativeAOT/NativeAOT_Test.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<LangVersion>preview</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
29 changes: 28 additions & 1 deletion tests/AheadOfTime/NativeAOT/check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$ErrorActionPreference = "Stop"

$root = "NativeAOT_Test"
$tfm = "net9.0"
$tfm = "net10.0"

$cwd = Get-Location
Set-Location $PSScriptRoot
Expand All @@ -20,6 +20,33 @@ if (-not ($LASTEXITCODE -eq 0)) {
Write-Error "NativeAOT publish failed with exit code $LASTEXITCODE" -ErrorAction Stop
}

# Prove this is a genuine net10 dogfood: a net10.0 consumer must resolve the locally-packed
# FSharp.Core's lib/net10.0 asset, not the netstandard2.1 fallback. Assert on the *selected*
# compile/runtime asset under "targets" (the "libraries" manifest lists every lib folder, so a
# plain substring search would false-pass even when ns2.1 was chosen). Without this the test would
# still succeed on the ns2.1 asset and the net10 target framework would go unexercised.
$assets = Join-Path $PSScriptRoot "obj/project.assets.json"
$assetsJson = Get-Content $assets -Raw | ConvertFrom-Json
$net10Selected = $false
foreach ($target in $assetsJson.targets.PSObject.Properties) {
foreach ($package in $target.Value.PSObject.Properties) {
if ($package.Name -like "FSharp.Core/*") {
$compileKeys = if ($package.Value.compile) { @($package.Value.compile.PSObject.Properties.Name) } else { @() }
$runtimeKeys = if ($package.Value.runtime) { @($package.Value.runtime.PSObject.Properties.Name) } else { @() }
# FSharp.Core packs only lib/{tfm} (no ref/, no runtimes/), so compile and runtime resolve
# from the same folder; require both to be net10 - anything else means a fallback was chosen.
if (($compileKeys -contains "lib/net10.0/FSharp.Core.dll") -and
($runtimeKeys -contains "lib/net10.0/FSharp.Core.dll")) {
$net10Selected = $true
}
}
}
}
if (-not $net10Selected) {
Set-Location $cwd
Write-Error "The net10.0 consumer did not resolve the lib/net10.0 FSharp.Core asset (it fell back to a lower target framework). The net10 FSharp.Core target framework is not being dogfooded. See $assets." -ErrorAction Stop
}

$exe = Join-Path $PSScriptRoot "bin/release/$tfm/win-x64/publish/$root.exe"
$output = (& $exe) -join "`n"
$exitCode = $LASTEXITCODE
Expand Down
Loading