forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.fsharpqa.test.fsx
61 lines (52 loc) · 2.53 KB
/
run.fsharpqa.test.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Work In Progress
// this script helps run a subset of the fsharpqa tests without calling a full build.cmd
open System.IO
open System.Diagnostics
let releaseOrDebug = "Debug"
let setEnvVar name value =
System.Environment.SetEnvironmentVariable(name, value)
let addToPath path =
let currentPath = System.Environment.GetEnvironmentVariable "PATH"
let splits = currentPath.Split(Path.PathSeparator)
if not(Array.contains path splits) then
setEnvVar "PATH" (path + (string Path.PathSeparator) + currentPath)
let nugetCache =
match System.Environment.GetEnvironmentVariable("NUGET_PACKAGES") with
| null -> Path.Combine(System.Environment.GetEnvironmentVariable "USERPROFILE", ".nuget", "packages")
| path -> path
let rootFolder = Path.Combine(__SOURCE_DIRECTORY__, "..", "..")
let compilerBinFolder = Path.Combine(rootFolder, "artifacts", "bin", "fsc", releaseOrDebug, "net472")
setEnvVar "CSC_PIPE" (Path.Combine(nugetCache, "Microsoft.Net.Compilers", "2.7.0", "tools", "csc.exe"))
setEnvVar "FSC" (Path.Combine(compilerBinFolder, "fsc.exe"))
setEnvVar "FSCOREDLLPATH" (Path.Combine(compilerBinFolder, "FSharp.Core.dll"))
addToPath compilerBinFolder
let runPerl arguments =
// Kill all Perl processes, and their children
ProcessStartInfo(
FileName = "taskkill",
Arguments = "/im perl.exe /f /t",
CreateNoWindow = true,
UseShellExecute = false
)
|> Process.Start
|> fun p -> p.WaitForExit()
use perlProcess =
ProcessStartInfo(
FileName = Path.Combine(nugetCache, "StrawberryPerl", "5.28.0.1", "bin", "perl.exe"),
Arguments = (arguments |> Array.map(fun a -> @"""" + a + @"""") |> String.concat " "),
WorkingDirectory = Path.Combine(rootFolder, "tests", "fsharpqa", "source"),
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false
)
|> Process.Start
while (not perlProcess.StandardOutput.EndOfStream) do
perlProcess.StandardOutput.ReadLine() |> printfn "%s"
while (not perlProcess.StandardError.EndOfStream) do
perlProcess.StandardError.ReadLine() |> printfn "%s"
perlProcess.WaitForExit()
if perlProcess.ExitCode <> 0 then
failwithf "exit code: %i" perlProcess.ExitCode
let testResultDir = Path.Combine(rootFolder, "tests", "TestResults")
let perlScript = Path.Combine(rootFolder, "tests", "fsharpqa", "testenv", "bin", "runall.pl")
runPerl [|perlScript; "-resultsroot";testResultDir ;"-ttags:Determinism"|]