Skip to content

Commit 573204f

Browse files
authored
Add back the coreclr fsharp unit test cases (dotnet#1971)
* Add back coreclr fsharp test cases * Add environment Variables to config report. * Report registry * Move et sdk paths earlier in process * Apparently mono has an issue with targetbefore= * Fix typos * More typos * Revert "More typos" This reverts commit 9e5bcbb. * Revert "Fix typos" This reverts commit 251cf80. * Revert "Apparently mono has an issue with targetbefore=" This reverts commit d10773d. * Change copy after targets * Use targets that work on ubuntu * Optional Arguments test case had a dependency on a non guaranteed environment variable.
1 parent bf2a110 commit 573204f

22 files changed

Lines changed: 323 additions & 283 deletions

File tree

build-everything.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</ItemGroup>
6363

6464
<ItemGroup Condition="'$(TEST_CORECLR_FSHARP_SUITE)'=='1'" >
65-
<ProjectsWithNet40 Include="tests/fsharp/FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj" />
65+
<ProjectsWithCoreClr Include="tests/fsharp/FSharp.Tests.FSharpSuite.DrivingCoreCLR/FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj" />
6666
</ItemGroup>
6767

6868
<ItemGroup Condition="'$(TEST_NET40_FSHARPQA_SUITE)'=='1' OR '$(TEST_NET40_FSHARP_SUITE)'=='1'" >

build.cmd

Lines changed: 49 additions & 93 deletions
Large diffs are not rendered by default.

src/FSharpSource.targets

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
<PortableNuGetMode>true</PortableNuGetMode>
170170
</PropertyGroup>
171171

172-
<PropertyGroup Condition="'$(TargetFramework)'=='coreclr' AND '$(UnitTestAssembly)' == 'true' ">
172+
<PropertyGroup Condition=" '$(TargetFramework)'=='coreclr' AND '$(DOTNET_PUBLISH_TEST)'=='true' ">
173173
<OutputPath>bin\$(Configuration)\netcoreapp1.0</OutputPath>
174174
<CustomOutputPath>true</CustomOutputPath>
175175
<DOTNET_PUBLISH>true</DOTNET_PUBLISH>
@@ -179,6 +179,12 @@
179179
<TargetExt>.dll</TargetExt>
180180
</PropertyGroup>
181181

182+
<PropertyGroup Condition=" '$(TargetFramework)'=='coreclr' AND '$(DOTNET_PUBLISH_COMPILERS)'=='true' ">
183+
<DOTNET_PUBLISH_FSC>true</DOTNET_PUBLISH_FSC>
184+
<DOTNET_PUBLISH_FSC_PATH>$(FSharpSourcesRoot)\..\tests\testbin\$(Configuration)\coreclr\FSC</DOTNET_PUBLISH_FSC_PATH>
185+
<DOTNET_PUBLISH_FSI>true</DOTNET_PUBLISH_FSI>
186+
<DOTNET_PUBLISH_FSI_PATH>$(FSharpSourcesRoot)\..\tests\testbin\$(Configuration)\coreclr\FSC</DOTNET_PUBLISH_FSI_PATH>
187+
</PropertyGroup>
182188

183189
<!-- Target Portable Profile 47 -->
184190
<PropertyGroup Condition="'$(TargetFramework)'=='portable47'">
@@ -478,14 +484,24 @@
478484
<Exec Command='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack %(PackageNuspec.Filename)%(PackageNuspec.Extension) -BasePath "$(OutputPath.TrimEnd("\"))" -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory "$(MSBuildThisFileDirectory)..\artifacts' />
479485
</Target>
480486

481-
<Target Name="dotnetrestore" BeforeTargets="Build" Condition=" '$(TargetFramework)' == 'coreclr' and '$(DOTNET_PUBLISH)' == 'true' ">
487+
<Target Name="dotnetrestore" BeforeTargets="Build" Condition=" '$(DOTNET_PUBLISH)' == 'true' ">
482488
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore --configfile $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json"/>
483489
</Target>
484490

485-
<Target Name="dotnetpublish" BeforeTargets="Build" Condition=" '$(TargetFramework)' == 'coreclr' and '$(DOTNET_PUBLISH)' == 'true' ">
491+
<Target Name="dotnetpublish" AfterTargets="Build" Condition=" '$(DOTNET_PUBLISH)' == 'true' ">
486492
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe publish --no-build project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_PATH)"/>
487493
</Target>
488494

495+
<Target Name="dotnetpublishfsccompiler" AfterTargets="CopyFilesToOutputDirectory" Condition=" '$(DOTNET_PUBLISH_FSC)' == 'true' ">
496+
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsc\project.json"/>
497+
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe publish --no-build DeployCompiler\fsc\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSC_PATH)"/>
498+
</Target>
499+
500+
<Target Name="dotnetpublishfsicompiler" AfterTargets="CopyFilesToOutputDirectory" Condition=" '$(DOTNET_PUBLISH_FSI)' == 'true' ">
501+
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsi\project.json"/>
502+
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe publish --no-build DeployCompiler\fsi\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSI_PATH)"/>
503+
</Target>
504+
489505
<Target Name="GenerateSourceLink" BeforeTargets="CoreCompile" Condition="'$(UseSourceLink)' == 'true'">
490506
<PropertyGroup>
491507
<SrcRootDirectory>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory.TrimEnd("\"))))</SrcRootDirectory>

src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<PropertyGroup>
55
<FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
66
<ProjectGuid>{88e2d422-6852-46e3-a740-83e391dc7973}</ProjectGuid>
7+
<DOTNET_PUBLISH_TEST>true</DOTNET_PUBLISH_TEST>
8+
<DOTNET_PUBLISH_COMPILERS>false</DOTNET_PUBLISH_COMPILERS>
79
</PropertyGroup>
810
<Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
911
<PropertyGroup>
@@ -66,21 +68,6 @@
6668
<Private>True</Private>
6769
</Reference>
6870
</ItemGroup>
69-
<!--
70-
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
71-
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
72-
<SpecificVersion>true</SpecificVersion>
73-
<Private>True</Private>
74-
<HintPath>..\..\..\packages\NUnit.3.5.0\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll</HintPath>
75-
</Reference>
76-
<Reference Include="nunitlite, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
77-
<SpecificVersion>true</SpecificVersion>
78-
<Private>True</Private>
79-
<HintPath>..\..\..\packages\NUnitLite.3.5.0\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac\nunitlite.dll</HintPath>
80-
</Reference>
81-
<None Include="project.json" />
82-
</ItemGroup>
83-
-->
8471
<ItemGroup Condition="(!$(TargetFramework.Contains('portable'))) and '$(TargetFramework)' != 'coreclr'">
8572
<Reference Include="mscorlib" />
8673
<Reference Include="System" />
@@ -138,10 +125,10 @@
138125
<Compile Include="SurfaceArea.$(TargetFramework).fs" />
139126
<Compile Include="Program.fs" Condition="'$(TargetFramework)' == 'coreclr'" />
140127
<CopyAndSubstituteText Include="FSharp.Core.Unittests.dll.config">
141-
<TargetFilename>FSharp.Core.Unittests.dll.config</TargetFilename>
142-
<Pattern1>FSCoreVersion</Pattern1>
143-
<Replacement1>$(FSCoreVersion)</Replacement1>
144-
</CopyAndSubstituteText>
128+
<TargetFilename>FSharp.Core.Unittests.dll.config</TargetFilename>
129+
<Pattern1>FSCoreVersion</Pattern1>
130+
<Replacement1>$(FSCoreVersion)</Replacement1>
131+
</CopyAndSubstituteText>
145132
</ItemGroup>
146133
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
147134
</Project>

src/fsharp/FSharp.Core/FSharp.Core.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232

233233
<!-- Hook compilation phase to do custom work -->
234234

235-
<Target Name="CopyToBuiltBin" BeforeTargets="BuiltProjectOutputGroup" AfterTargets="CoreCompile" >
235+
<Target Name="CopyToBuiltBin" BeforeTargets="AfterCompile" AfterTargets="CoreCompile" >
236236
<ItemGroup>
237237
<BuiltProjectOutputGroupKeyOutput Include="$(IntermediateOutputPath)\FSharp.Core.sigdata" />
238238
<BuiltProjectOutputGroupKeyOutput Include="$(IntermediateOutputPath)\FSharp.Core.optdata" />

src/scripts/scriptlib.fsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module Scripting =
6363
let getFullPath a = Path.GetFullPath a
6464
let getFilename a = Path.GetFileName a
6565
let getDirectoryName a = Path.GetDirectoryName a
66-
66+
6767
let copyFile source dir =
6868
let dest =
6969
if not (Directory.Exists dir) then Directory.CreateDirectory dir |>ignore
@@ -132,7 +132,7 @@ module Scripting =
132132
|> Option.iter (fun _ -> p.StartInfo.RedirectStandardInput <- true)
133133

134134
p.Start() |> ignore
135-
135+
136136
cmdArgs.RedirectOutput |> Option.iter (fun _ -> p.BeginOutputReadLine())
137137
cmdArgs.RedirectError |> Option.iter (fun _ -> p.BeginErrorReadLine())
138138

@@ -158,19 +158,19 @@ module Scripting =
158158
member x.Post (msg:string) = lock writer (fun () -> writer.WriteLine(msg))
159159
interface System.IDisposable with
160160
member __.Dispose() = writer.Flush()
161-
161+
162162
let redirectTo (writer: TextWriter) = new OutPipe (writer)
163163

164164
let redirectToLog () = redirectTo System.Console.Out
165165

166-
166+
#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
167167
let defaultPlatform =
168168
match Environment.OSVersion.Platform, Environment.Is64BitOperatingSystem with
169-
| PlatformID.MacOSX, true -> "osx.10.10-x64"
169+
| PlatformID.MacOSX, true -> "osx.10.11-x64"
170170
| PlatformID.Unix,true -> "ubuntu.14.04-x64"
171171
| _, true -> "win7-x64"
172172
| _, false -> "win7-x86"
173-
173+
#endif
174174

175175
let executeProcessNoRedirect filename arguments =
176176
let info = ProcessStartInfo(Arguments=arguments, UseShellExecute=false,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "1.0.0-*",
3+
"name": "fsc",
4+
"buildOptions": {
5+
"debugType": "portable",
6+
"emitEntryPoint": true
7+
},
8+
"dependencies": {
9+
"Microsoft.FSharp.Compiler.netcore": "1.0.0-alpha-*",
10+
},
11+
"runtimes": {
12+
"win7-x86": { },
13+
"win7-x64": { },
14+
"osx.10.10-x64": { },
15+
"ubuntu.14.04-x64": { }
16+
},
17+
"frameworks": {
18+
"netcoreapp1.0": {
19+
"dependencies": {
20+
"Microsoft.NETCore.App": {
21+
"type": "platform",
22+
"version": "1.0.1"
23+
}
24+
},
25+
}
26+
},
27+
"scripts": {
28+
"postpublish": [ "cmd /c copy %publish:OutputPath%\\runtimes\\any\\native\\* %publish:OutputPath%" ]
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "1.0.0-*",
3+
"name": "fsi",
4+
"buildOptions": {
5+
"debugType": "portable",
6+
"emitEntryPoint": true
7+
},
8+
"dependencies": {
9+
"Microsoft.FSharp.Compiler.netcore": "1.0.0-alpha-*",
10+
},
11+
"runtimes": {
12+
"win7-x86": { },
13+
"win7-x64": { },
14+
"osx.10.10-x64": { },
15+
"ubuntu.14.04-x64": { }
16+
},
17+
"frameworks": {
18+
"netcoreapp1.0": {
19+
"dependencies": {
20+
"Microsoft.NETCore.App": {
21+
"type": "platform",
22+
"version": "1.0.1"
23+
}
24+
},
25+
}
26+
},
27+
"scripts": {
28+
"postpublish": [ "cmd /c copy %publish:OutputPath%\\runtimes\\any\\native\\* %publish:OutputPath%" ]
29+
}
30+
}

tests/fsharp/FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj renamed to tests/fsharp/FSharp.Tests.FSharpSuite.DrivingCoreCLR/FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..\src</FSharpSourcesRoot>
4+
<FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..\..\src</FSharpSourcesRoot>
55
<ProjectGuid>{bda4d411-6ad9-4b3e-a3b3-07bad6bef1ed}</ProjectGuid>
6+
<DOTNET_PUBLISH_TEST>true</DOTNET_PUBLISH_TEST>
7+
<DOTNET_PUBLISH_COMPILERS>true</DOTNET_PUBLISH_COMPILERS>
68
</PropertyGroup>
79
<Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
810
<PropertyGroup>
@@ -23,17 +25,18 @@
2325
</PropertyGroup>
2426
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
2527
<ItemGroup>
26-
<Compile Include="..\..\src\scripts\scriptlib.fsx">
28+
<Compile Include="..\..\..\src\scripts\scriptlib.fsx">
2729
<Link>scriptlib.fsx</Link>
2830
</Compile>
29-
<Compile Include="test-framework.fs" />
30-
<Compile Include="..\..\src\fsharp\FSharp.Compiler.Unittests\NunitHelpers.fs">
31+
<Compile Include="..\test-framework.fs" />
32+
<Compile Include="..\..\..\src\fsharp\FSharp.Compiler.Unittests\NunitHelpers.fs">
3133
<Link>NunitHelpers.fs</Link>
3234
</Compile>
33-
<Compile Include="single-test.fs" />
34-
<Compile Include="tests.fs" />
35+
<Compile Include="..\single-test.fs" />
36+
<Compile Include="..\tests.fs" />
37+
<Compile Include="Program.fs" Condition="'$(TargetFramework)' == 'coreclr'" />
3538
</ItemGroup>
36-
<ItemGroup>
39+
<ItemGroup Condition=" '$(TargetFramework)' != 'coreclr' ">
3740
<Reference Include="mscorlib" />
3841
<Reference Include="System" />
3942
<Reference Include="System.Core" />
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.25928.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Tests.FSharpSuite.DrivingCoreCLR", "FSharp.Tests.FSharpSuite.DrivingCoreCLR.fsproj", "{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Proto|Any CPU = Proto|Any CPU
12+
Release|Any CPU = Release|Any CPU
13+
EndGlobalSection
14+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15+
{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16+
{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
18+
{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Proto|Any CPU.Build.0 = Proto|Any CPU
19+
{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{BDA4D411-6AD9-4B3E-A3B3-07BAD6BEF1ED}.Release|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
GlobalSection(SolutionProperties) = preSolution
23+
HideSolutionNode = FALSE
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)