Skip to content

Commit 320087f

Browse files
committed
tests
1 parent 46b0241 commit 320087f

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

eng/Build.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ try {
437437
$buildTool = InitializeBuildTool
438438
$toolsetBuildProj = InitializeToolset
439439
TryDownloadDotnetFrameworkSdk
440+
441+
$dotnetPath = InitializeDotNetCli
442+
$env:DOTNET_ROOT="$dotnetPath"
443+
Get-Item -Path Env:
444+
440445
if ($bootstrap) {
441446
$script:BuildMessage = "Failure building bootstrap compiler"
442447
$bootstrapDir = Make-BootstrapBuild

src/fsharp/fsc.fs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,13 @@ let main1OfAst
646646
rangeForErrors=range0)
647647

648648
let primaryAssembly =
649-
// temporary workaround until https://github.com/dotnet/fsharp/pull/8043 is merged:
650-
// pick a primary assembly based on the current runtime.
651-
// It's an ugly compromise used to avoid exposing primaryAssembly in the public api for this function.
652-
let isNetCoreAppProcess = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith ".NET Core"
653-
if isNetCoreAppProcess then PrimaryAssembly.System_Runtime
654-
else PrimaryAssembly.Mscorlib
649+
// MsCorlib is a good default for all seasons...
650+
// portable profiles and netstandard rely on System_Runtime but we need to do work to detect that scenario
651+
let includesSystem_Runtime = dllReferences |> Seq.exists(fun f -> Path.GetFileName(f).Equals("system.runtime.dll",StringComparison.InvariantCultureIgnoreCase))
652+
if includesSystem_Runtime then
653+
PrimaryAssembly.System_Runtime
654+
else
655+
PrimaryAssembly.Mscorlib
655656

656657
tcConfigB.target <- target
657658
tcConfigB.primaryAssembly <- primaryAssembly

tests/FSharp.Test.Utilities/TestFramework.fs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ type TestConfig =
204204
PEVERIFY : string
205205
Directory: string
206206
DotNetExe: string
207+
DotNetMultiLevelLookup: string
208+
DotNetRoot: string
207209
DefaultPlatform: string}
208210

209211
#if NETCOREAPP
@@ -347,29 +349,34 @@ let config configurationName envVars =
347349
vbc_flags = vbc_flags
348350
Directory=""
349351
DotNetExe = dotNetExe
352+
DotNetMultiLevelLookup = System.Environment.GetEnvironmentVariable "DOTNET_MULTILEVEL_LOOKUP"
353+
DotNetRoot = System.Environment.GetEnvironmentVariable "DOTNET_ROOT"
350354
DefaultPlatform = defaultPlatform }
351355

352356
let logConfig (cfg: TestConfig) =
353357
log "---------------------------------------------------------------"
354358
log "Executables"
355359
log ""
356-
log "CSC =%s" cfg.CSC
357-
log "BUILD_CONFIG =%s" cfg.BUILD_CONFIG
358-
log "csc_flags =%s" cfg.csc_flags
359-
log "FSC =%s" cfg.FSC
360-
log "fsc_flags =%s" cfg.fsc_flags
361-
log "FSCOREDLLPATH =%s" cfg.FSCOREDLLPATH
362-
log "FSI =%s" cfg.FSI
363-
#if !NETCOREAPP
364-
log "FSIANYCPU =%s" cfg.FSIANYCPU
360+
log "CSC = %s" cfg.CSC
361+
log "BUILD_CONFIG = %s" cfg.BUILD_CONFIG
362+
log "csc_flags = %s" cfg.csc_flags
363+
log "FSC = %s" cfg.FSC
364+
log "fsc_flags = %s" cfg.fsc_flags
365+
log "FSCOREDLLPATH = %s" cfg.FSCOREDLLPATH
366+
log "FSI = %s" cfg.FSI
367+
#if NETCOREAPP
368+
log "DotNetExe =%s" cfg.DotNetExe
369+
log "DOTNET_MULTILEVEL_LOOKUP = %s" cfg.DotNetMultiLevelLookup
370+
log "DOTNET_ROOT = %s" cfg.DotNetRoot
371+
#else
372+
log "FSIANYCPU = %s" cfg.FSIANYCPU
365373
#endif
366-
log "FSI_FOR_SCRIPTS =%s" cfg.FSI_FOR_SCRIPTS
367-
log "fsi_flags =%s" cfg.fsi_flags
368-
log "ILDASM =%s" cfg.ILDASM
369-
log "PEVERIFY =%s" cfg.PEVERIFY
374+
log "FSI_FOR_SCRIPTS = %s" cfg.FSI_FOR_SCRIPTS
375+
log "fsi_flags = %s" cfg.fsi_flags
376+
log "ILDASM = %s" cfg.ILDASM
377+
log "PEVERIFY = %s" cfg.PEVERIFY
370378
log "---------------------------------------------------------------"
371379

372-
373380
let checkResult result =
374381
match result with
375382
| CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err)

0 commit comments

Comments
 (0)