提交 da2d7f0d 编写于 作者: V Vlad Zarytovskii

Fixed CompilerAssert for non-windows; Updated README

上级 79846a4f
......@@ -54,6 +54,14 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "DependencyManager", "src\fs
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{FAC5A3BF-C0D6-437A-868A-E962AA00B418}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fsharpqa", "fsharpqa", "{292C4F92-A313-4CAF-9552-731F39C6C21F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testenv", "testenv", "{FF76050A-415A-4FB4-A0E5-13CBF38D83E0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{07482B5E-4980-4285-B732-820F15870284}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PEVerify", "tests\fsharpqa\testenv\src\PEVerify\PEVerify.csproj", "{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -292,6 +300,18 @@ Global
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|x86.ActiveCfg = Release|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|x86.Build.0 = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|x86.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|x86.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|Any CPU.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|x86.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|x86.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|Any CPU.Build.0 = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|x86.ActiveCfg = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -315,6 +335,10 @@ Global
{4FEDF286-0252-4EBC-9E75-879CCA3B85DC} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
{FAC5A3BF-C0D6-437A-868A-E962AA00B418} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{292C4F92-A313-4CAF-9552-731F39C6C21F} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{FF76050A-415A-4FB4-A0E5-13CBF38D83E0} = {292C4F92-A313-4CAF-9552-731F39C6C21F}
{07482B5E-4980-4285-B732-820F15870284} = {FF76050A-415A-4FB4-A0E5-13CBF38D83E0}
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20} = {07482B5E-4980-4285-B732-820F15870284}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BD5177C7-1380-40E7-94D2-7768E1A8B1B8}
......
......@@ -5,11 +5,14 @@
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
<ReferenceVsAssemblies>true</ReferenceVsAssemblies>
<OutputType>Library</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
<UnitTestType>xunit</UnitTestType>
<NoWarn>$(NoWarn);3186;1104</NoWarn>
<NoWarn>$(NoWarn);3186;1104;FS0988</NoWarn>
</PropertyGroup>
<ItemGroup>
......
......@@ -125,7 +125,6 @@ let main argv = 0"""
File.WriteAllText(programFsFileName, programFs)
let pInfo = ProcessStartInfo ()
pInfo.FileName <- config.DotNetExe
pInfo.Arguments <- "build"
pInfo.WorkingDirectory <- projectDirectory
......@@ -147,7 +146,7 @@ let main argv = 0"""
cleanUp <- false
printfn "%s" output
printfn "%s" errors
raise (new Exception (sprintf "An error occured getting netcoreapp references: %A" e))
raise (new Exception (sprintf "An error occurred getting netcoreapp references: %A" e))
finally
if cleanUp then
try Directory.Delete(projectDirectory) with | _ -> ()
......
......@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81</AssetTargetFallback>
<ReferenceVsAssemblies>true</ReferenceVsAssemblies>
<OutputType>Library</OutputType>
......
......@@ -142,28 +142,57 @@ type TestConfig =
DotNetExe: string
DefaultPlatform: string}
#if NETCOREAPP
open System.Runtime.InteropServices
#endif
module WindowsPlatform =
let Is64BitOperatingSystem envVars =
// On Windows PROCESSOR_ARCHITECTURE has the value AMD64 on 64 bit Intel Machines
let value =
let find s = envVars |> Map.tryFind s
[| "PROCESSOR_ARCHITECTURE" |] |> Seq.tryPick (fun s -> find s) |> function None -> "" | Some x -> x
value = "AMD64"
let getOperatingSystem () =
#if NETCOREAPP
let isPlatform p = RuntimeInformation.IsOSPlatform(p)
if isPlatform OSPlatform.Windows then "win"
elif isPlatform OSPlatform.Linux then "linux"
elif isPlatform OSPlatform.OSX then "osx"
else "unknown"
#else
"win"
#endif
type FSLibPaths =
module DotnetPlatform =
let Is64BitOperatingSystem envVars =
match getOperatingSystem () with
| "win" ->
// On Windows PROCESSOR_ARCHITECTURE has the value AMD64 on 64 bit Intel Machines
let value =
let find s = envVars |> Map.tryFind s
[| "PROCESSOR_ARCHITECTURE" |] |> Seq.tryPick (fun s -> find s) |> function None -> "" | Some x -> x
value = "AMD64"
| _ -> System.Environment.Is64BitOperatingSystem // As an alternative for netstandard1.4+: System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture
type FSLibPaths =
{ FSCOREDLLPATH : string }
let requireFile nm =
if Commands.fileExists __SOURCE_DIRECTORY__ nm |> Option.isSome then nm else failwith (sprintf "couldn't find %s. Running 'build test' once might solve this issue" nm)
let packagesDir =
match Environment.GetEnvironmentVariable("NUGET_PACKAGES") with
| null -> Environment.GetEnvironmentVariable("USERPROFILE") ++ ".nuget" ++ "packages"
| path -> path
let getPackagesDir () =
let p = match Environment.GetEnvironmentVariable("NUGET_PACKAGES") with
| null ->
match Environment.GetEnvironmentVariable("USERPROFILE") with
| null -> Environment.GetEnvironmentVariable("HOME")
| p -> p
| path -> path
p ++ ".nuget" ++ "packages"
let requireFile dir path =
// Linux filesystems are (in most cases) case-sensitive.
// However when nuget packages are installed to $HOME/.nuget/packages, it seems they are lowercased
let fullPath = (dir ++ path)
match Commands.fileExists __SOURCE_DIRECTORY__ fullPath with
| Some p -> p
| None ->
let fullPathLower = (dir ++ path.ToLower())
match Commands.fileExists __SOURCE_DIRECTORY__ fullPathLower with
| Some p -> p
| None -> failwith (sprintf "Couldn't find \"%s\" on the following paths: \"%s\", \"%s\". Running 'build test' once might solve this issue" path fullPath fullPathLower)
let config configurationName envVars =
let SCRIPT_ROOT = __SOURCE_DIRECTORY__
#if NET472
let fscArchitecture = "net472"
......@@ -171,12 +200,14 @@ let config configurationName envVars =
let fsharpCoreArchitecture = "net45"
let fsharpBuildArchitecture = "net472"
let fsharpCompilerInteractiveSettingsArchitecture = "net472"
let peverifyArchitecture = "net472"
#else
let fscArchitecture = "netcoreapp3.0"
let fsiArchitecture = "netcoreapp3.0"
let fsharpCoreArchitecture = "netstandard2.0"
let fsharpBuildArchitecture = "netcoreapp3.0"
let fsharpCompilerInteractiveSettingsArchitecture = "netstandard2.0"
let peverifyArchitecture = "netcoreapp3.0"
#endif
let repoRoot = SCRIPT_ROOT ++ ".." ++ ".."
let artifactsPath = repoRoot ++ "artifacts"
......@@ -185,31 +216,42 @@ let config configurationName envVars =
let csc_flags = "/nologo"
let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED"
let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror"
let Is64BitOperatingSystem = WindowsPlatform.Is64BitOperatingSystem envVars
let operatingSystem = getOperatingSystem ()
let Is64BitOperatingSystem = DotnetPlatform.Is64BitOperatingSystem envVars
let architectureMoniker = if Is64BitOperatingSystem then "x64" else "x86"
let CSC = requireFile (packagesDir ++ "Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe")
let ILDASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ildasm.exe")
let ILASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ilasm.exe")
let coreclrdll = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "coreclr.dll")
let PEVERIFY = requireFile (artifactsBinPath ++ "PEVerify" ++ configurationName ++ "net472" ++ "PEVerify.exe")
let FSI_FOR_SCRIPTS = artifactsBinPath ++ "fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.exe"
let FSharpBuild = requireFile (artifactsBinPath ++ "FSharp.Build" ++ configurationName ++ fsharpBuildArchitecture ++ "FSharp.Build.dll")
let FSharpCompilerInteractiveSettings = requireFile (artifactsBinPath ++ "FSharp.Compiler.Interactive.Settings" ++ configurationName ++ fsharpCompilerInteractiveSettingsArchitecture ++ "FSharp.Compiler.Interactive.Settings.dll")
let packagesDir = getPackagesDir ()
let requirePackage = requireFile packagesDir
let requireArtifact = requireFile artifactsBinPath
let CSC = requirePackage ("Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe")
let ILDASM_EXE = if operatingSystem = "windows" then "ildasm.exe" else "ildasm"
let ILDASM = requirePackage (("runtime." + operatingSystem + "-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ (operatingSystem + "-" + architectureMoniker) ++ "native" ++ ILDASM_EXE)
let ILASM_EXE = if operatingSystem = "windows" then "ilasm.exe" else "ilasm"
let ILASM = requirePackage (("runtime." + operatingSystem + "-" + architectureMoniker + ".Microsoft.NETCore.ILAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ (operatingSystem + "-" + architectureMoniker) ++ "native" ++ ILASM_EXE)
let CORECLR_DLL = if operatingSystem = "windows" then "coreclr.dll" elif operatingSystem = "osx" then "libcoreclr.dylib" else "libcoreclr.so"
let coreclrdll = requirePackage (("runtime." + operatingSystem + "-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ (operatingSystem + "-" + architectureMoniker) ++ "native" ++ CORECLR_DLL)
let PEVERIFY_EXE = if operatingSystem = "windows" then "PEVerify.exe" else "PEVerify"
let PEVERIFY = requireArtifact ("PEVerify" ++ configurationName ++ peverifyArchitecture ++ PEVERIFY_EXE)
let FSharpBuild = requireArtifact ("FSharp.Build" ++ configurationName ++ fsharpBuildArchitecture ++ "FSharp.Build.dll")
let FSharpCompilerInteractiveSettings = requireArtifact ("FSharp.Compiler.Interactive.Settings" ++ configurationName ++ fsharpCompilerInteractiveSettingsArchitecture ++ "FSharp.Compiler.Interactive.Settings.dll")
let dotNetExe =
// first look for {repoRoot}\.dotnet\dotnet.exe, otherwise fallback to %PATH%
let repoLocalDotnetPath = repoRoot ++ ".dotnet" ++ "dotnet.exe"
let DOTNET_EXE = if operatingSystem = "windows" then "dotnet.exe" else "dotnet"
let repoLocalDotnetPath = repoRoot ++ ".dotnet" ++ DOTNET_EXE
if File.Exists(repoLocalDotnetPath) then repoLocalDotnetPath
else "dotnet.exe"
else DOTNET_EXE
// ildasm + ilasm requires coreclr.dll to run which has already been restored to the packages directory
File.Copy(coreclrdll, Path.GetDirectoryName(ILDASM) ++ "coreclr.dll", overwrite=true)
File.Copy(coreclrdll, Path.GetDirectoryName(ILASM) ++ "coreclr.dll", overwrite=true)
File.Copy(coreclrdll, Path.GetDirectoryName(ILDASM) ++ CORECLR_DLL, overwrite=true)
File.Copy(coreclrdll, Path.GetDirectoryName(ILASM) ++ CORECLR_DLL, overwrite=true)
let FSI = requireFile (FSI_FOR_SCRIPTS)
let FSI_FOR_SCRIPTS = ("fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.exe")
let FSI = requireArtifact FSI_FOR_SCRIPTS
#if !NETCOREAPP
let FSIANYCPU = requireFile (artifactsBinPath ++ "fsiAnyCpu" ++ configurationName ++ "net472" ++ "fsiAnyCpu.exe")
let FSIANYCPU = requireArtifact ("fsiAnyCpu" ++ configurationName ++ "net472" ++ "fsiAnyCpu.exe")
#endif
let FSC = requireFile (artifactsBinPath ++ "fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe")
let FSCOREDLLPATH = requireFile (artifactsBinPath ++ "FSharp.Core" ++ configurationName ++ fsharpCoreArchitecture ++ "FSharp.Core.dll")
let FSC = requireArtifact ("fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe")
let FSCOREDLLPATH = requireArtifact ("FSharp.Core" ++ configurationName ++ fsharpCoreArchitecture ++ "FSharp.Core.dll")
let defaultPlatform =
match Is64BitOperatingSystem with
......@@ -279,9 +321,9 @@ let envVars () =
let initializeSuite () =
#if DEBUG
let configurationName = "debug"
let configurationName = "Debug"
#else
let configurationName = "release"
let configurationName = "Release"
#endif
let env = envVars ()
......
......@@ -93,10 +93,9 @@ Existing FSharpQA and Cambridge need to be migrated to corresponding test projec
## Next steps
* [**In Progress**] Move `FSharp.TestHelpers` to `FSharp.Test.Utilities`.
* [**In Progress**] Create initial test projects structure for new tests (`FSharp.Compiler.ComponentTests`).
* [**In Progress**] Migrate existing `NUnit` tests to xUnit.
* [**In progress**] Change build scripts to run new suites as well as old ones.
* Clean up CompilerAssert.
* Make PEVerify tests work in netcore/non-windows environment.
* Start migration of existing (namely, FSharpQA and Cambridge) suites to xUnit-based projects.
## Open questions:
......@@ -108,5 +107,3 @@ Existing FSharpQA and Cambridge need to be migrated to corresponding test projec
Related issues: (https://github.com/dotnet/fsharp/issues/7075)
You can find this document under 'tests/README.md'.
**I would like to hear some feedback the community, so we can quickly re-iterate over it (if needed), and start working :)**
\ No newline at end of file
......@@ -49,7 +49,6 @@
<Compile Include="Compiler\ErrorMessages\WarnExpressionTests.fs" />
<Compile Include="Compiler\ErrorMessages\DontSuggestTests.fs" />
<Compile Include="Compiler\ErrorMessages\MissingExpressionTests.fs" />
<Compile Include="Compiler\ErrorMessages\InvalidNumericLiteralTests.fs" />
<Compile Include="Compiler\ErrorMessages\ModuleAbbreviationTests.fs" />
<Compile Include="Compiler\Warnings\AssignmentWarningTests.fs" />
<Compile Include="Compiler\Warnings\ExperimentalAttributeTests.fs" />
......
......@@ -2,7 +2,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册