diff --git a/tests/fsharpqa/run.fsharpqa.test.fsx b/tests/fsharpqa/run.fsharpqa.test.fsx index 101e41f7a2d..45d01450086 100644 --- a/tests/fsharpqa/run.fsharpqa.test.fsx +++ b/tests/fsharpqa/run.fsharpqa.test.fsx @@ -3,7 +3,7 @@ open System.IO open System.Diagnostics - +type Env = System.Environment let releaseOrDebug = "Debug" let setEnvVar name value = System.Environment.SetEnvironmentVariable(name, value) @@ -17,27 +17,57 @@ let addToPath path = let rootFolder = Path.Combine(__SOURCE_DIRECTORY__, "..", "..") let compilerBinFolder = Path.Combine(rootFolder, releaseOrDebug, "net40", "bin") + +// this needs to be kept in sync with something else somewhere else +// this is probably outdated setEnvVar "CSC_PIPE" (Path.Combine(rootFolder, "packages", "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 = // a bit expeditive, but does the deed Process.GetProcessesByName("perl") |> Array.iter (fun p -> p.Kill()) use perlProcess = new Process() - perlProcess.StartInfo.set_FileName (Path.Combine(rootFolder, "packages", "StrawberryPerl64.5.22.2.1", "Tools", "perl", "bin", "perl.exe")) + let userRoot = Env.SpecialFolder.UserProfile |> Env.GetFolderPath + + let perlExe = + [| userRoot + ".nuget" + "packages" + "strawberryperl64" + "5.22.2.1" + "Tools" + "perl" + "bin" + "perl.exe" |] + |> Path.Combine + |> FileInfo + + if not perlExe.Exists then failwithf "couldn't find %s, please adjust this script" perlExe.FullName else + + printfn "found perl.exe in %s" perlExe.Directory.FullName + + perlProcess.StartInfo.set_FileName (perlExe.FullName) perlProcess.StartInfo.set_Arguments (arguments |> Array.map(fun a -> @"""" + a + @"""") |> String.concat " ") perlProcess.StartInfo.set_WorkingDirectory (Path.Combine(rootFolder, "tests", "fsharpqa", "source")) perlProcess.StartInfo.set_RedirectStandardOutput true perlProcess.StartInfo.set_RedirectStandardError true perlProcess.StartInfo.set_UseShellExecute false + + printfn "starting perl.exe from directory: %s\nwith arguments: %s" perlProcess.StartInfo.WorkingDirectory perlProcess.StartInfo.Arguments + perlProcess.Start() |> ignore + 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