From 9bd0fc0279272398aefc4dec7d0e9ccd96e9a4a7 Mon Sep 17 00:00:00 2001 From: Gaurav Khanna Date: Mon, 14 Mar 2016 20:36:14 -0700 Subject: [PATCH] Fix timeout determination for tests Commit migrated from https://github.com/dotnet/coreclr/commit/d42c40105324f760744b993f02b66613ff3a7a73 --- src/coreclr/tests/runtest.proj | 12 +++++++++++- .../src/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/coreclr/tests/runtest.proj b/src/coreclr/tests/runtest.proj index 4c9a646..a37452c 100644 --- a/src/coreclr/tests/runtest.proj +++ b/src/coreclr/tests/runtest.proj @@ -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" + diff --git a/src/coreclr/tests/src/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs b/src/coreclr/tests/src/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs index d70c937..d012dca 100644 --- a/src/coreclr/tests/src/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs +++ b/src/coreclr/tests/src/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs @@ -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) { -- 2.7.4