Merge remote-tracking branch 'origin/master' into mono-2018-08

This commit is contained in:
Rolf Bjarne Kvinge 2018-11-27 19:10:48 +01:00
Родитель 428310c181 e8d780229b
Коммит 4e3dec7894
4 изменённых файлов: 77 добавлений и 24 удалений

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

@ -63,13 +63,13 @@ namespace MonoMac {
public const string ScriptingBridgeLibrary = "/System/Library/Frameworks/ScriptingBridge.framework/ScriptingBridge"; public const string ScriptingBridgeLibrary = "/System/Library/Frameworks/ScriptingBridge.framework/ScriptingBridge";
public const string CoreDataLibrary = "/System/Library/Frameworks/CoreData.framework/CoreData"; public const string CoreDataLibrary = "/System/Library/Frameworks/CoreData.framework/CoreData";
public const string CoreImageLibrary = "/System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/CoreImage"; public const string CoreImageLibrary = "/System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/CoreImage";
public const string CFNetworkLibrary = "/System/Library/Frameworks/CFNetwork.framework/CFNetwork"; public const string CFNetworkLibrary = "/System/Library/Frameworks/CoreServices.framework/Frameworks/CFNetwork.framework/CFNetwork";
public const string CoreMidiLibrary = "/System/Library/Frameworks/CoreMIDI.framework/CoreMIDI"; public const string CoreMidiLibrary = "/System/Library/Frameworks/CoreMIDI.framework/CoreMIDI";
public const string QuickLookLibrary = "/System/Library/Frameworks/QuickLook.framework/QuickLook"; public const string QuickLookLibrary = "/System/Library/Frameworks/QuickLook.framework/QuickLook";
public const string AVFoundationLibrary = "/System/Library/Frameworks/AVFoundation.framework/AVFoundation"; public const string AVFoundationLibrary = "/System/Library/Frameworks/AVFoundation.framework/AVFoundation";
public const string AccelerateImageLibrary = "/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage"; public const string AccelerateImageLibrary = "/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage";
public const string CoreBluetoothLibrary = "/System/Library/Frameworks//CoreBluetooth.framework/CoreBluetooth"; public const string CoreBluetoothLibrary = "/System/Library/Frameworks/IOBluetooth.framework/Versions/A/Frameworks/CoreBluetooth.framework/CoreBluetooth";
public const string GameKitLibrary = "/System/Library/Frameworks/GameKit.framework/GameKit"; public const string GameKitLibrary = "/System/Library/Frameworks/GameKit.framework/GameKit";
public const string SceneKitLibrary = "/System/Library/Frameworks/SceneKit.framework/SceneKit"; public const string SceneKitLibrary = "/System/Library/Frameworks/SceneKit.framework/SceneKit";
public const string StoreKitLibrary = "/System/Library/Frameworks/StoreKit.framework/StoreKit"; public const string StoreKitLibrary = "/System/Library/Frameworks/StoreKit.framework/StoreKit";

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

@ -1042,10 +1042,18 @@ namespace Introspection
#if MONOMAC #if MONOMAC
// on macOS the file should exist on the specified path // on macOS the file should exist on the specified path
// for iOS the simulator paths do not match the strings // for iOS the simulator paths do not match the strings
if (!File.Exists (lib)) { switch (lib) {
if (lib != Constants.CoreImageLibrary) // location changed in 10.8 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CFNetworkLibrary:
// location changed in 10.10 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CoreBluetoothLibrary:
// location changed in 10.11 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CoreImageLibrary:
break;
default:
if (!File.Exists (lib))
return false; return false;
// location changed in 10.11 but it loads fine (and fixing it breaks on earlier macOS) break;
} }
#endif #endif
var h = IntPtr.Zero; var h = IntPtr.Zero;

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

@ -83,25 +83,29 @@ namespace xharness
Devices.Harness = Harness; Devices.Harness = Harness;
if (SimulatorLoadLog == null) if (SimulatorLoadLog == null)
SimulatorLoadLog = Logs.Create ($"simulator-list-{Harness.Timestamp}.log", "Simulator Listing"); SimulatorLoadLog = Logs.Create ($"simulator-list-{Harness.Timestamp}.log", "Simulator Listing (in progress)");
var simulatorLoadTask = Task.Run (async () => { var simulatorLoadTask = Task.Run (async () => {
try { try {
await Simulators.LoadAsync (SimulatorLoadLog); await Simulators.LoadAsync (SimulatorLoadLog);
SimulatorLoadLog.Description = "Simulator Listing (ok)";
} catch (Exception e) { } catch (Exception e) {
SimulatorLoadLog.WriteLine ("Failed to load simulators:"); SimulatorLoadLog.WriteLine ("Failed to load simulators:");
SimulatorLoadLog.WriteLine (e); SimulatorLoadLog.WriteLine (e);
SimulatorLoadLog.Description = $"Simulator Listing ({e.Message})";
} }
}); });
if (DeviceLoadLog == null) if (DeviceLoadLog == null)
DeviceLoadLog = Logs.Create ($"device-list-{Harness.Timestamp}.log", "Device Listing"); DeviceLoadLog = Logs.Create ($"device-list-{Harness.Timestamp}.log", "Device Listing (in progress)");
var deviceLoadTask = Task.Run (async () => { var deviceLoadTask = Task.Run (async () => {
try { try {
await Devices.LoadAsync (DeviceLoadLog, removed_locked: true); await Devices.LoadAsync (DeviceLoadLog, removed_locked: true);
DeviceLoadLog.Description = "Device Listing (ok)";
} catch (Exception e) { } catch (Exception e) {
DeviceLoadLog.WriteLine ("Failed to load devices:"); DeviceLoadLog.WriteLine ("Failed to load devices:");
DeviceLoadLog.WriteLine (e); DeviceLoadLog.WriteLine (e);
DeviceLoadLog.Description = $"Device Listing ({e.Message})";
} }
}); });
@ -1159,33 +1163,59 @@ namespace xharness
} }
} }
break; break;
case "/stoptest":
case "/runtest": case "/runtest":
response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain; response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain;
using (var writer = new StreamWriter (response.OutputStream)) { IEnumerable<TestTask> find_tasks (StreamWriter writer, string ids)
int id; {
var id_inputs = arguments ["id"].Split (','); var id_inputs = ids.Split (',');
// We want to randomize the order the tests are added, so that we don't build first the test for one device,
// then for another, since that would not take advantage of running tests on several devices in parallel.
var rnd = new Random ((int) DateTime.Now.Ticks);
id_inputs = id_inputs.OrderBy (v => rnd.Next ()).ToArray ();
foreach (var id_input in id_inputs) { foreach (var id_input in id_inputs) {
if (int.TryParse (id_input, out id)) { if (int.TryParse (id_input, out var id)) {
var task = Tasks.FirstOrDefault ((t) => t.ID == id); var task = Tasks.FirstOrDefault ((t) => t.ID == id);
if (task == null) if (task == null)
task = Tasks.Where ((v) => v is AggregatedRunSimulatorTask).Cast<AggregatedRunSimulatorTask> ().SelectMany ((v) => v.Tasks).FirstOrDefault ((t) => t.ID == id); task = Tasks.Where ((v) => v is AggregatedRunSimulatorTask).Cast<AggregatedRunSimulatorTask> ().SelectMany ((v) => v.Tasks).FirstOrDefault ((t) => t.ID == id);
if (task == null) { if (task == null) {
writer.WriteLine ($"Could not find test {id}"); writer.WriteLine ($"Could not find test {id}");
} else if (task.InProgress || task.Waiting) { } else {
yield return task;
}
} else {
writer.WriteLine ($"Could not parse {arguments ["id"]}");
}
}
}
using (var writer = new StreamWriter (response.OutputStream)) {
var id_inputs = arguments ["id"].Split (',');
var tasks = find_tasks (writer, arguments ["id"]);
// We want to randomize the order the tests are added, so that we don't build first the test for one device,
// then for another, since that would not take advantage of running tests on several devices in parallel.
var rnd = new Random ((int) DateTime.Now.Ticks);
tasks = tasks.OrderBy ((v) => rnd.Next ());
foreach (var task in tasks) {
switch (request.Url.LocalPath) {
case "/stoptest":
if (!task.Waiting) {
writer.WriteLine ($"Test '{task.TestName}' is not in a waiting state.");
} else {
task.Reset ();
writer.WriteLine ($"OK: {task.ID}");
}
break;
case "/runtest":
if (task.InProgress || task.Waiting) {
writer.WriteLine ($"Test '{task.TestName}' is already executing."); writer.WriteLine ($"Test '{task.TestName}' is already executing.");
} else { } else {
task.Reset (); task.Reset ();
task.RunAsync (); task.RunAsync ();
writer.WriteLine ("OK"); writer.WriteLine ($"OK: {task.ID}");
} }
} else { break;
writer.WriteLine ($"Could not parse {arguments ["id"]}"); default:
throw new NotImplementedException ();
} }
} }
} }
@ -1630,6 +1660,10 @@ function runtest(id)
{ {
sendrequest (""runtest?id="" + id); sendrequest (""runtest?id="" + id);
} }
function stoptest(id)
{
sendrequest (""stoptest?id="" + id);
}
function sendrequest(url, callback) function sendrequest(url, callback)
{ {
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
@ -1758,7 +1792,7 @@ function toggleAll (show)
writer.WriteLine ("<h1>Test results</h1>"); writer.WriteLine ("<h1>Test results</h1>");
foreach (var log in Logs) foreach (var log in Logs)
writer.WriteLine ("<a href='{0}' type='text/plain'>{1}</a><br />", log.FullPath.Substring (LogDirectory.Length + 1), log.Description); writer.WriteLine ("<span id='x{2}' class='autorefreshable'> <a href='{0}' type='text/plain'>{1}</a></span><br />", log.FullPath.Substring (LogDirectory.Length + 1), log.Description, id_counter++);
var headerColor = "black"; var headerColor = "black";
if (unfinishedTests.Any ()) { if (unfinishedTests.Any ()) {
@ -1989,8 +2023,17 @@ function toggleAll (show)
writer.Write ($"<div class='pdiv {ignoredClass}'>"); writer.Write ($"<div class='pdiv {ignoredClass}'>");
writer.Write ($"<span id='button_{log_id}' class='expander' onclick='javascript: toggleLogVisibility (\"{log_id}\");'>{defaultExpander}</span>"); writer.Write ($"<span id='button_{log_id}' class='expander' onclick='javascript: toggleLogVisibility (\"{log_id}\");'>{defaultExpander}</span>");
writer.Write ($"<span id='x{id_counter++}' class='p3 autorefreshable' onclick='javascript: toggleLogVisibility (\"{log_id}\");'>{title} (<span style='color: {GetTestColor (test)}'>{state}</span>) </span>"); writer.Write ($"<span id='x{id_counter++}' class='p3 autorefreshable' onclick='javascript: toggleLogVisibility (\"{log_id}\");'>{title} (<span style='color: {GetTestColor (test)}'>{state}</span>) </span>");
if (IsServerMode && !test.InProgress && !test.Waiting) if (IsServerMode) {
writer.Write ($" <span><a class='runall' href='javascript:runtest ({test.ID})'>Run</a></span> "); writer.Write ($" <span id='x{id_counter++}' class='autorefreshable'>");
if (test.Waiting) {
writer.Write ($" <a class='runall' href='javascript:stoptest ({test.ID})'>Stop</a> ");
} else if (test.InProgress) {
// Stopping is not implemented for tasks that are already executing
} else {
writer.Write ($" <a class='runall' href='javascript:runtest ({test.ID})'>Run</a> ");
}
writer.Write ("</span> ");
}
writer.WriteLine ("</div>"); writer.WriteLine ("</div>");
writer.WriteLine ($"<div id='logs_{log_id}' class='autorefreshable logs togglable' data-onautorefresh='{log_id}' style='display: {defaultDisplay};'>"); writer.WriteLine ($"<div id='logs_{log_id}' class='autorefreshable logs togglable' data-onautorefresh='{log_id}' style='display: {defaultDisplay};'>");

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

@ -1,6 +1,8 @@
TOP=../.. TOP=../..
include $(TOP)/Make.config include $(TOP)/Make.config
export DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT)
# #
# mmp # mmp
# #