diff options
author | danmosemsft <danmose@microsoft.com> | 2017-07-28 08:36:55 +0300 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2017-08-03 07:10:16 +0300 |
commit | 1fd56de4d9b76ff79be3c03c42aad4421364de4a (patch) | |
tree | 8460648a9287492129df12db73fcc30ac4b28a46 /src/CoreFx.Private.TestUtilities | |
parent | 346d4511c1a5768cdb657f6a3c30e193be511bcb (diff) |
Dump remote exception
Diffstat (limited to 'src/CoreFx.Private.TestUtilities')
-rw-r--r-- | src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs | 2 | ||||
-rw-r--r-- | src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs b/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs index 49ff3d9ffb..a248802e1e 100644 --- a/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs +++ b/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs @@ -51,7 +51,7 @@ namespace System.Diagnostics } // If we need the host (if it exists), use it, otherwise target the console app directly. - string metadataArgs = PasteArguments.Paste(new string[] { a.FullName, t.FullName, method.Name }, pasteFirstArgumentUsingArgV0Rules: false); + string metadataArgs = PasteArguments.Paste(new string[] { a.FullName, t.FullName, method.Name, options.ExceptionFile }, pasteFirstArgumentUsingArgV0Rules: false); string passedArgs = pasteArguments ? PasteArguments.Paste(args, pasteFirstArgumentUsingArgV0Rules: false) : string.Join(" ", args); string testConsoleAppArgs = ExtraParameter + " " + metadataArgs + " " + passedArgs; diff --git a/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs b/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs index 84641484e5..a1e011eb42 100644 --- a/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs +++ b/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs @@ -167,16 +167,26 @@ namespace System.Diagnostics Assert.True(Process.WaitForExit(Options.TimeOut), $"Timed out after {Options.TimeOut}ms waiting for remote process {Process.Id}"); + if (File.Exists(Options.ExceptionFile)) + { + Assert.True(false, File.ReadAllText(Options.ExceptionFile)); + } + if (Options.CheckExitCode) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - Assert.Equal(Options.ExpectedExitCode, Process.ExitCode); - else - Assert.Equal(unchecked((sbyte)Options.ExpectedExitCode), unchecked((sbyte)Process.ExitCode)); + int expected = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Options.ExpectedExitCode : unchecked((sbyte)Options.ExpectedExitCode); + int actual = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Process.ExitCode : unchecked((sbyte)Process.ExitCode); + + Assert.True(Options.ExpectedExitCode == Process.ExitCode, $"Exit code was {Process.ExitCode} but it should have been {Options.ExpectedExitCode}"); } } finally { + if (File.Exists(Options.ExceptionFile)) + { + File.Delete(Options.ExceptionFile); + } + // Cleanup try { Process.Kill(); } catch { } // ignore all cleanup errors @@ -199,5 +209,7 @@ namespace System.Diagnostics public int TimeOut {get; set; } = RemoteExecutorTestBase.FailWaitTimeoutMilliseconds; public int ExpectedExitCode { get; set; } = RemoteExecutorTestBase.SuccessExitCode; + public string ExceptionFile { get; } = Path.GetRandomFileName(); + } } |