diff options
author | Alan McGovern <alan.mcgovern@gmail.com> | 2017-02-27 06:04:25 +0300 |
---|---|---|
committer | Alan McGovern <alan.mcgovern@gmail.com> | 2017-02-27 06:07:08 +0300 |
commit | f1b9f939acdd72bf481eb5697fd9838fd1ba2464 (patch) | |
tree | 26aea02e4ac6ac9be1c3fb898c3586d7c02b0bbf | |
parent | 54f599934319558e391d4c6b89ad7e85d4f95366 (diff) |
[GuiUnit] Just exit when the tests are finished
If we allow the finalizers to run we may end up returning
a failure exit code if the finalizer does something wrong.
For example xamarin.mac can crash while finalizing CALayers
but we do not really want that to mark our test run as failed.
2017-02-27T02:37:28.1153580Z stderr: Unhandled Exception:
2017-02-27T02:37:28.1186210Z stderr: System.Exception: Failed to marshal the Objective-C object 0x7f85edb651e0 (type: Xamarin_Designer_Mac_DesignerDragOperationMac_MacDragImage_LayerScaleTransitionDelegate). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Xamarin.Designer.Mac.DesignerDragOperationMac+MacDragImage+LayerScaleTransitionDelegate' does not have a constructor that takes one IntPtr argument).
2017-02-27T02:37:28.1204140Z stderr: at ObjCRuntime.Runtime.MissingCtor (System.IntPtr ptr, System.IntPtr klass, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution resolution) [0x0006e] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1218240Z stderr: at ObjCRuntime.Runtime.ConstructNSObject[T] (System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x0002c] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1232350Z stderr: at ObjCRuntime.Runtime.ConstructNSObject (System.IntPtr ptr, System.IntPtr klass, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x00015] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1246740Z stderr: at ObjCRuntime.Runtime.GetNSObject (System.IntPtr ptr, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution, System.Boolean evenInFinalizerQueue) [0x00034] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1260580Z stderr: at Registrar.DynamicRegistrar.GetMethodDescriptionAndObject (System.Type type, System.IntPtr selector, System.IntPtr obj, System.IntPtr& mthis) [0x00068] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1274350Z stderr: at ObjCRuntime.Runtime.GetMethodAndObjectForSelector (System.IntPtr klass, System.IntPtr sel, System.IntPtr obj, System.IntPtr& mthis) [0x0000c] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1289980Z stderr: at ObjCRuntime.Runtime.get_method_and_object_for_selector (System.IntPtr cls, System.IntPtr sel, System.IntPtr obj, System.IntPtr& mthis, System.Int32& exception_gchandle) [0x00006] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1313850Z stderr: --- End of stack trace from previous location where exception was thrown ---
2017-02-27T02:37:28.1331490Z stderr: at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_IntPtr (intptr,intptr,intptr)
2017-02-27T02:37:28.1345900Z stderr: at CoreAnimation.CALayer.set_WeakDelegate (Foundation.NSObject value) [0x0002e] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1358800Z stderr: at CoreAnimation.CALayer.OnDispose () [0x00024] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1371610Z stderr: at CoreAnimation.CALayer.Dispose (System.Boolean disposing) [0x00001] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
2017-02-27T02:37:28.1384350Z stderr: at Foundation.NSObject.Finalize () [0x00001] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
-rw-r--r-- | src/framework/GuiUnit/TestRunner.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/framework/GuiUnit/TestRunner.cs b/src/framework/GuiUnit/TestRunner.cs index 56da295..189e8db 100644 --- a/src/framework/GuiUnit/TestRunner.cs +++ b/src/framework/GuiUnit/TestRunner.cs @@ -69,6 +69,7 @@ namespace GuiUnit public static int Main (string[] args) { new TestRunner ().Execute (args); + Environment.Exit (ExitCode); return ExitCode; } @@ -345,7 +346,7 @@ namespace GuiUnit private void RunTests(ITestFilter filter) { ITestResult result = runner.Run(this, filter); - ExitCode = result.FailCount; + ExitCode = Math.Min (result.FailCount, 255); new ResultReporter(result, writer).ReportResults(); if (commandLineOptions.ResultFile != null) { |