[xharness] Attach a native debugger when running watchOS tests on device. (#560)

Attaching a native debugger prevents the watch from backgrounding
the app, and makes the test run able to complete without having
to babysit it.
This commit is contained in:
Rolf Bjarne Kvinge 2016-08-05 21:03:56 +02:00 коммит произвёл GitHub
Родитель ba278764e6
Коммит 9f3d438169
2 изменённых файлов: 12 добавлений и 4 удалений

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

@ -1,5 +1,5 @@
ifdef ENABLE_XAMARIN
NEEDED_MACCORE_VERSION := 2ff8293d6e2a0d37a7bf784cdd41b079afa531dd
NEEDED_MACCORE_VERSION := 395484fb8831a870089b857fb4cce5ccb31136f8
NEEDED_MACCORE_BRANCH := master
MACCORE_DIRECTORY := maccore

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

@ -474,6 +474,12 @@ namespace xharness
args.Append (" --launchdev");
args.AppendFormat (" \"{0}\" ", launchAppPath);
var waits_for_exit = false;
if (mode == "watchos") {
args.Append (" --attach-native-debugger"); // this prevents the watch from backgrounding the app.
waits_for_exit = true;
}
AddDeviceName (args);
@ -489,9 +495,11 @@ namespace xharness
listener.StartAsync ();
main_log.WriteLine ("Starting test run");
// This will not wait for app completion
await ProcessHelper.ExecuteCommandAsync (Harness.MlaunchPath, args.ToString (), main_log, TimeSpan.FromMinutes (1));
if (listener.WaitForCompletion (TimeSpan.FromMinutes (Harness.Timeout))) {
double launch_timeout = waits_for_exit ? Harness.Timeout : 1;
double listener_timeout = waits_for_exit ? 0.2 : Harness.Timeout;
await ProcessHelper.ExecuteCommandAsync (Harness.MlaunchPath, args.ToString (), main_log, TimeSpan.FromMinutes (launch_timeout));
if (listener.WaitForCompletion (TimeSpan.FromMinutes (listener_timeout))) {
main_log.WriteLine ("Test run completed");
} else {
main_log.WriteLine ("Test run did not complete in {0} minutes.", Harness.Timeout);