Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed Feb 10, 2021
1 parent 46b0241 commit 320087f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
5 changes: 5 additions & 0 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ try {
$buildTool = InitializeBuildTool
$toolsetBuildProj = InitializeToolset
TryDownloadDotnetFrameworkSdk

$dotnetPath = InitializeDotNetCli
$env:DOTNET_ROOT="$dotnetPath"
Get-Item -Path Env:

if ($bootstrap) {
$script:BuildMessage = "Failure building bootstrap compiler"
$bootstrapDir = Make-BootstrapBuild
Expand Down
13 changes: 7 additions & 6 deletions src/fsharp/fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,13 @@ let main1OfAst
rangeForErrors=range0)

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

tcConfigB.target <- target
tcConfigB.primaryAssembly <- primaryAssembly
Expand Down
35 changes: 21 additions & 14 deletions tests/FSharp.Test.Utilities/TestFramework.fs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ type TestConfig =
PEVERIFY : string
Directory: string
DotNetExe: string
DotNetMultiLevelLookup: string
DotNetRoot: string
DefaultPlatform: string}

#if NETCOREAPP
Expand Down Expand Up @@ -347,29 +349,34 @@ let config configurationName envVars =
vbc_flags = vbc_flags
Directory=""
DotNetExe = dotNetExe
DotNetMultiLevelLookup = System.Environment.GetEnvironmentVariable "DOTNET_MULTILEVEL_LOOKUP"
DotNetRoot = System.Environment.GetEnvironmentVariable "DOTNET_ROOT"
DefaultPlatform = defaultPlatform }

let logConfig (cfg: TestConfig) =
log "---------------------------------------------------------------"
log "Executables"
log ""
log "CSC =%s" cfg.CSC
log "BUILD_CONFIG =%s" cfg.BUILD_CONFIG
log "csc_flags =%s" cfg.csc_flags
log "FSC =%s" cfg.FSC
log "fsc_flags =%s" cfg.fsc_flags
log "FSCOREDLLPATH =%s" cfg.FSCOREDLLPATH
log "FSI =%s" cfg.FSI
#if !NETCOREAPP
log "FSIANYCPU =%s" cfg.FSIANYCPU
log "CSC = %s" cfg.CSC
log "BUILD_CONFIG = %s" cfg.BUILD_CONFIG
log "csc_flags = %s" cfg.csc_flags
log "FSC = %s" cfg.FSC
log "fsc_flags = %s" cfg.fsc_flags
log "FSCOREDLLPATH = %s" cfg.FSCOREDLLPATH
log "FSI = %s" cfg.FSI
#if NETCOREAPP
log "DotNetExe =%s" cfg.DotNetExe
log "DOTNET_MULTILEVEL_LOOKUP = %s" cfg.DotNetMultiLevelLookup
log "DOTNET_ROOT = %s" cfg.DotNetRoot
#else
log "FSIANYCPU = %s" cfg.FSIANYCPU
#endif
log "FSI_FOR_SCRIPTS =%s" cfg.FSI_FOR_SCRIPTS
log "fsi_flags =%s" cfg.fsi_flags
log "ILDASM =%s" cfg.ILDASM
log "PEVERIFY =%s" cfg.PEVERIFY
log "FSI_FOR_SCRIPTS = %s" cfg.FSI_FOR_SCRIPTS
log "fsi_flags = %s" cfg.fsi_flags
log "ILDASM = %s" cfg.ILDASM
log "PEVERIFY = %s" cfg.PEVERIFY
log "---------------------------------------------------------------"


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

0 comments on commit 320087f

Please sign in to comment.