From 529838da17c2cccdb507cffa417f0ce73fef4810 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 21 Nov 2015 16:38:43 +0100 Subject: [PATCH] don't depend on installed F# for running tests, fixes #357. --- build.fsx | 25 ++++++++++++++++++++++++- tests/FSharp.Literate.Tests/Tests.fs | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/build.fsx b/build.fsx index 2d5274c5f..80397d398 100644 --- a/build.fsx +++ b/build.fsx @@ -169,6 +169,29 @@ let testProjects = [ "FSharp.CodeFormat.Tests"; "FSharp.Literate.Tests"; "FSharp.Markdown.Tests"; "FSharp.MetadataFormat.Tests" ] +Target "WorkaroundInstalledFSharp4_3" (fun _ -> + // Travis has FSharp 4.3 installed and we need 4.4 to execute the tests + // Because FSC always prefers a local FSharp.Core over the installed one + // We just copy it to the nunit-runner + [ "FSharp.Core.dll"; "FSharp.Core.optdata"; "FSharp.Core.sigdata" ] + |> Seq.iter (fun f -> + let source = "packages/FAKE/tools" @@ f + let dest1 = "packages/NUnit.Runners/tools" @@ f + let dest2 = "tests/FSharp.Literate.Tests/bin/Release" @@ f + printfn "Copying %s to %s" source dest1 + printfn "Copying %s to %s" source dest2 + try + System.IO.File.Copy(source, dest1, true) + System.IO.File.Copy(source, dest2, true) + with e -> printfn "failed to copy: %s" e.Message) +) + +Target "PreRunTests" <| ignore + +"BuildTests" + ==> "WorkaroundInstalledFSharp4_3" + ==> "PreRunTests" + Target "RunTests" <| ignore // For each test project file, generate a new "RunTest_Xyz" which @@ -184,7 +207,7 @@ for name in testProjects do Framework = "4.0" OutputFile = "TestResults.xml" }) taskName ==> "RunTests" |> ignore - "BuildTests" ==> taskName |> ignore + "PreRunTests" ==> taskName |> ignore // -------------------------------------------------------------------------------------- // Build a NuGet package diff --git a/tests/FSharp.Literate.Tests/Tests.fs b/tests/FSharp.Literate.Tests/Tests.fs index 24c8167ac..45cb7e767 100644 --- a/tests/FSharp.Literate.Tests/Tests.fs +++ b/tests/FSharp.Literate.Tests/Tests.fs @@ -39,7 +39,7 @@ do // Test that everything works Logging.infof "FSharp.Formatting Logging setup!" - Yaaf.FSharp.Scripting.Log.infof "Yaaf.FSharp.Scripting Logging setup!" + Yaaf.FSharp.Scripting.Log.infof "Yaaf.FSharp.Scripting Logging setup (BaseDirectory: %s)!" System.AppDomain.CurrentDomain.BaseDirectory with e -> printfn "FSharp.Formatting Logging setup failed: %A" e