Fix timeout determination for tests
authorGaurav Khanna <gkhanna@microsoft.com>
Tue, 15 Mar 2016 03:36:14 +0000 (20:36 -0700)
committerGaurav Khanna <gkhanna@microsoft.com>
Tue, 15 Mar 2016 03:36:14 +0000 (20:36 -0700)
tests/runtest.proj
tests/src/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs

index 4c9a646..a37452c 100644 (file)
@@ -279,8 +279,18 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
 
                 if (ret != CoreclrTestWrapperLib.EXIT_SUCCESS_CODE)
                 {
+                    string sErrorText = null%3B
+                    try
+                    {
+                        sErrorText = System.IO.File.ReadAllText(errorFile)%3B
+                    }
+                    catch(Exception ex)
+                    {
+                      sErrorText = "Unable to read error file: " + errorFile%3B
+                    }
+
                     string msg = infraEx != null ? "Test Infrastructure Failure: " + infraEx.Message
-                                                 : System.IO.File.ReadAllText(errorFile) + "\n\n" +
+                                                 : sErrorText + "\n\n" +
                                                    "Raw output:      " + outputFile + "\n" +
                                                    "To run the test:\n" +
                                                    "> set CORE_ROOT=" + _Global.coreRoot + "\n" +
index d70c937..d012dca 100644 (file)
@@ -41,9 +41,9 @@ namespace CoreclrTestLib
                 Task copyOutput = process.StandardOutput.BaseStream.CopyToAsync(outputStream);
                 Task copyError = process.StandardError.BaseStream.CopyToAsync(errorStream);
 
-                bool completed = process.WaitForExit(timeout) &&
-                    copyOutput.Wait(timeout) &&
-                    copyError.Wait(timeout);
+                bool completed = process.WaitForExit(timeout);
+                copyOutput.Wait(timeout);
+                copyError.Wait(timeout);
 
                 if (completed)
                 {