未验证 提交 c0b044c6 编写于 作者: K Kevin Ransom (msft) 提交者: GitHub

Use WaitForExit(timeout) rather than loop on HasExited property for some tests (#3906)

* bump

* Remove reliance on HasExited, instead use WaitForExit(timeout)

* Huge timeout in fcs tests

* Remove bump space

* Replace scary computed constants with hipster TimeSpans

* fix comment

* Of course TotalMilliseconds is float and Milliseconds is int --- use Milliseconds

* Use the Timespan APIs correctly
上级 e6004121
......@@ -4,6 +4,8 @@ open System
open System.Diagnostics
open System.IO
let longtime = int(System.TimeSpan.FromSeconds(30.0).TotalMilliseconds) // longtime is 30 seconds
let programFiles =
let pf86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)")
if String.IsNullOrEmpty(pf86) then Environment.GetEnvironmentVariable("ProgramFiles") else pf86
......@@ -26,7 +28,7 @@ let start (p1 : string) = Process.Start(p1)
let CompileFile file args =
let p = Process.Start(fsc, file + " " + args)
while not (p.HasExited) do ()
p.WaitForExit()
[<EntryPoint>]
let main (args : string[]) =
......@@ -40,13 +42,13 @@ let main (args : string[]) =
printfn "Compiled DerivedType with %A" derivedFlag
let r1 = start "DerivedType.exe"
while not r1.HasExited do ()
r1.WaitForExit(longtime)
printfn "Ran DerivedType.exe with result: %A" r1.ExitCode
CompileFile "BaseType.fs" "-a"
printfn "Compiled BaseType without %A" baseFlag
let r2 = start "DerivedType.exe"
while not r2.HasExited do ()
r2.WaitForExit(longtime)
printfn "Ran DerivedType.exe with result: %A" r2.ExitCode
if r1.ExitCode = expectedResult1 && r2.ExitCode = expectedResult2 then 0 else 1
......
......@@ -76,6 +76,8 @@ type PEVerifier () =
#endif
static let execute (fileName : string, arguments : string) =
// Peverify may run quite a while some assemblies are pretty big. Make the timeout 3 minutes just in case.
let longtime = int (TimeSpan.FromMinutes(3.0).TotalMilliseconds)
printfn "executing '%s' with arguments %s" fileName arguments
let psi = new ProcessStartInfo(fileName, arguments)
psi.UseShellExecute <- false
......@@ -87,7 +89,7 @@ type PEVerifier () =
use proc = Process.Start(psi)
let stdOut = proc.StandardOutput.ReadToEnd()
let stdErr = proc.StandardError.ReadToEnd()
while not proc.HasExited do ()
proc.WaitForExit(longtime)
proc.ExitCode, stdOut, stdErr
member __.Verify(assemblyPath : string) =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册