Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions tests/FSharp.Test.Utilities/Utilities.fs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ open System
let main argv = 0"""

let private getNetCoreAppReferences =
let mutable output = ""
let mutable errors = ""
let mutable output = [||]
let mutable errors = [||]
let mutable cleanUp = true
let pathToArtifacts = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../.."))
if Path.GetFileName(pathToArtifacts) <> "artifacts" then failwith "CompilerAssert did not find artifacts directory --- has the location changed????"
Expand All @@ -303,9 +303,11 @@ let main argv = 0"""
File.WriteAllText(directoryBuildTargetsFileName, directoryBuildTargets)

let timeout = 30000
let exitCode, output, errors = Commands.executeProcess (Some config.DotNetExe) "build" projectDirectory timeout

let exitCode, dotnetoutput, dotneterrors = Commands.executeProcess (Some config.DotNetExe) "build" projectDirectory timeout
if exitCode <> 0 || errors.Length > 0 then
errors <- dotneterrors
output <- dotnetoutput
printfn "Output:\n=======\n"
output |> Seq.iter(fun line -> printfn "STDOUT:%s\n" line)
printfn "Errors:\n=======\n"
Expand All @@ -315,12 +317,18 @@ let main argv = 0"""
File.ReadLines(frameworkReferencesFileName) |> Seq.toArray
with | e ->
cleanUp <- false
printfn "Project directory: %s" projectDirectory
printfn "STDOUT: %s" output
File.WriteAllText(Path.Combine(projectDirectory, "project.stdout"), output)
printfn "STDERR: %s" errors
File.WriteAllText(Path.Combine(projectDirectory, "project.stderror"), errors)
raise (new Exception (sprintf "An error occurred getting netcoreapp references: %A" e))
let message =
let output = output |> String.concat "\nSTDOUT: "
let errors = errors |> String.concat "\nSTDERR: "
File.WriteAllText(Path.Combine(projectDirectory, "project.stdout"), output)
File.WriteAllText(Path.Combine(projectDirectory, "project.stderror"), errors)
$"""
Project directory: %s{projectDirectory}
STDOUT: %s{output}
STDERR: %s{errors}
An error occurred getting netcoreapp references: %A{e}
"""
raise (Exception (message, e))
finally
if cleanUp then
try Directory.Delete(projectDirectory, recursive=true) with | _ -> ()
Expand Down