diff --git a/external/Touch.Unit b/external/Touch.Unit index a33e0c3f2e..f19eb45cb6 160000 --- a/external/Touch.Unit +++ b/external/Touch.Unit @@ -1 +1 @@ -Subproject commit a33e0c3f2e80f3ff2e2d9078a82a260b20d259a9 +Subproject commit f19eb45cb6439bc2bb03d467364b27867e346502 diff --git a/tests/common/mac/MacMain.cs b/tests/common/mac/MacMain.cs index cd76e45ced..64b9e27523 100644 --- a/tests/common/mac/MacMain.cs +++ b/tests/common/mac/MacMain.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; +using System.Threading; using System.Threading.Tasks; namespace Xamarin.Mac.Tests { @@ -12,7 +13,24 @@ namespace Xamarin.Mac.Tests { arguments.RemoveAll ((arg) => arg.StartsWith ("-psn_", StringComparison.Ordinal)); var exit_code = await MonoTouch.NUnit.UI.MacRunner.MainAsync (arguments, true, _exit, typeof (MainClass).Assembly); + +#if NET + var exit_monitor = new Thread (() => + { + // Wait for 3 seconds + Thread.Sleep (3000); + // If we're still here, then something went wrong. Let's exit. + Console.WriteLine ($"The process didn't exist within 3s of returning from Main. Assuming something is deadlocked, and will now exit immediately and forcefully (with exit code {exit_code})."); + _exit (exit_code); + }) { + Name = "Exit monitor", + IsBackground = true, + }; + exit_monitor.Start (); +#else _exit (exit_code); +#endif + return exit_code; }