[tests] Don't forcefully exit macOS tests. (#10844)

* [tests] Don't forcefully exit macOS tests.

Instead give the process a chance to exist (3 seconds), before we take drastic
measures.

* Bump Touch.Unit.

New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@f19eb45 [TouchRunner] Try to make MacRunner exit nicely. (#100)

Diff: a33e0c3f2e..f19eb45cb6

* It looks like mono from 2020-02 doesn't want to exit no matter what, so limit this to .NET.
This commit is contained in:
Rolf Bjarne Kvinge 2021-03-17 18:46:29 +01:00 коммит произвёл GitHub
Родитель cb18cb881f
Коммит 3f018eedb6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 19 добавлений и 1 удалений

2
external/Touch.Unit поставляемый

@ -1 +1 @@
Subproject commit a33e0c3f2e80f3ff2e2d9078a82a260b20d259a9
Subproject commit f19eb45cb6439bc2bb03d467364b27867e346502

Просмотреть файл

@ -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;
}