-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>4634f264-784e-42da-b5a1-fe72125deafc</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Fsdk.Tests</RootNamespace> | ||
<AssemblyName>Fsdk.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion> | ||
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Name>Fsdk</Name> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<Tailcalls>false</Tailcalls> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<WarningLevel>3</WarningLevel> | ||
<DocumentationFile>bin\Debug\Fsdk.Tests.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<Tailcalls>true</Tailcalls> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<WarningLevel>3</WarningLevel> | ||
<DocumentationFile>bin\Release\Fsdk.Tests.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DefineConstants>$(DefineConstants);LEGACY_FRAMEWORK</DefineConstants> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="mscorlib" /> | ||
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
<Private>True</Private> | ||
</Reference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="NUnit" /> | ||
<PackageReference Include="NUnit3TestAdapter" /> | ||
<PackageReference Include="NUnit.Analyzers" /> | ||
<PackageReference Include="coverlet.collector" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="FSharpUtil.fs" /> | ||
<Compile Include="AsyncExtensions.fs" /> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Fsdk\Fsdk-legacy.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\CommonBuildProps-legacy.proj" /> | ||
<Import Condition="'$(FSharpTargetsPath)' != ''" Project="$(FSharpTargetsPath)" /> | ||
<Target Name="BeforeBuild"> | ||
<Message Condition="'$(FSharpTargetsPath)' == ''" Importance="High" Text="F# SDK path was not found!" /> | ||
</Target> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
open System | ||
open System.IO | ||
open System.Net | ||
open System.Linq | ||
open System.Diagnostics | ||
|
||
#r "System.Configuration" | ||
open System.Configuration | ||
|
||
#load "../Fsdk/Misc.fs" | ||
#load "../Fsdk/Process.fs" | ||
#load "../Fsdk/Network.fs" | ||
#load "../Fsdk/Git.fs" | ||
|
||
open Fsdk | ||
open Fsdk.Process | ||
|
||
let ScriptsDir = __SOURCE_DIRECTORY__ |> DirectoryInfo | ||
let RootDir = Path.Combine(ScriptsDir.FullName, "..") |> DirectoryInfo | ||
let TestDir = Path.Combine(RootDir.FullName, "test") |> DirectoryInfo | ||
let NugetDir = Path.Combine(RootDir.FullName, ".nuget") |> DirectoryInfo | ||
let NugetExe = Path.Combine(NugetDir.FullName, "nuget.exe") |> FileInfo | ||
let NugetPackages = Path.Combine(RootDir.FullName, "packages") |> DirectoryInfo | ||
|
||
let NugetScriptsPackagesDir() = | ||
let dir = Path.Combine(NugetDir.FullName, "packages") |> DirectoryInfo | ||
|
||
if not dir.Exists then | ||
Directory.CreateDirectory dir.FullName |> ignore | ||
|
||
dir | ||
|
||
let MakeCheckCommand(commandName: string) = | ||
if not(Process.CommandWorksInShell commandName) then | ||
Console.Error.WriteLine( | ||
sprintf "%s not found, please install it first" commandName | ||
) | ||
|
||
Environment.Exit 1 | ||
|
||
let RunUnitTests() = | ||
Console.WriteLine "Running unit tests...\n" | ||
|
||
let testProjectName = "Fsdk.Tests" | ||
#if !LEGACY_FRAMEWORK | ||
let testTarget = | ||
Path.Combine( | ||
RootDir.FullName, | ||
testProjectName, | ||
testProjectName + ".fsproj" | ||
) | ||
|> FileInfo | ||
#else | ||
// so that we get file names in stack traces | ||
Environment.SetEnvironmentVariable("MONO_ENV_OPTIONS", "--debug") | ||
|
||
let testTarget = | ||
Path.Combine( | ||
RootDir.FullName, | ||
testProjectName, | ||
"bin", | ||
"Debug", | ||
testProjectName + ".dll" | ||
) | ||
|> FileInfo | ||
#endif | ||
|
||
if not testTarget.Exists then | ||
failwithf "File not found: %s" testTarget.FullName | ||
|
||
let runnerCommand = | ||
#if !LEGACY_FRAMEWORK | ||
{ | ||
Command = "dotnet" | ||
Arguments = "test " + testTarget.FullName | ||
} | ||
#else | ||
match Misc.GuessPlatform() with | ||
| Misc.Platform.Linux -> | ||
let nunitCommand = "nunit-console" | ||
MakeCheckCommand nunitCommand | ||
|
||
{ | ||
Command = nunitCommand | ||
Arguments = testTarget.FullName | ||
} | ||
| _ -> | ||
//if not NugetExe.Exists then | ||
// MakeAll() |> ignore | ||
|
||
let nunitVersion = "2.7.1" | ||
let pkgOutputDir = NugetScriptsPackagesDir() | ||
|
||
Network.InstallNugetPackage | ||
NugetExe | ||
pkgOutputDir | ||
"NUnit.Runners" | ||
(Some nunitVersion) | ||
Echo.All | ||
|> ignore | ||
|
||
{ | ||
Command = | ||
Path.Combine( | ||
NugetScriptsPackagesDir().FullName, | ||
sprintf "NUnit.Runners.%s" nunitVersion, | ||
"tools", | ||
"nunit-console.exe" | ||
) | ||
Arguments = testTarget.FullName | ||
} | ||
#endif | ||
|
||
Process | ||
.Execute(runnerCommand, Echo.All) | ||
.UnwrapDefault() | ||
|> ignore | ||
|
||
RunUnitTests() |