summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Cavalcante de Sousa <lucks.sousa@gmail.com>2020-11-25 10:38:46 -0300
committerFelipe Magno de Almeida <felipe@expertise.dev>2020-11-25 10:44:41 -0300
commit4797602e84e9da4347d9f95a94f0c0b4e545d38d (patch)
tree2c8f7ba6fd6b72327899a70e1524f63611d98960
parent4de94638a645517d9fd23454f81383a531a5c1b2 (diff)
efl_mono: Use architecture independent ECANCELED
Summary: `efl_mono` was assuming ECANCELED as in Linux, which made some tests fail. `test_simple_futere_cancel` and `test_cancel_after_resolve` checks if the returned error code is `ECANCELED` but `Eina.Error.ECANCELED` was base on Linux `ECANCELED` which is diferent from OSX causing: ``` [ ERROR ] AssertionException: /Users/lucas/expertise/efl1/src/tests/efl_mono/Promises.cs:138 (test_simple_future_cancel) Left hand side "Eina.Error(89)", right hand side "Eina.Error(125)" at Test.AssertEquals[T](T lhs, T rhs, String msg, Int32 line, String file, String member) in /Users/lucas/expertise/efl1/src/tests/efl_mono/TestUtils.cs:line 73 at TestSuite.TestPromises.test_simple_future_cancel() in /Users/lucas/expertise/efl1/src/tests/efl_mono/Promises.cs:line 138 [ FAIL ] TestPromises.test_simple_future_cancel ``` ``` [ ERROR ] AssertionException: /Users/lucas/expertise/efl1/src/tests/efl_mono/Promises.cs:256 (test_cancel_after_resolve) Left hand side "Eina.Error(89)", right hand side "Eina.Error(125)" at Test.AssertEquals[T](T lhs, T rhs, String msg, Int32 line, String file, String member) in /Users/lucas/expertise/efl1/src/tests/efl_mono/TestUtils.cs:line 73 at TestSuite.TestPromises.test_cancel_after_resolve() in /Users/lucas/expertise/efl1/src/tests/efl_mono/Promises.cs:line 256 [ FAIL ] TestPromises.test_cancel_after_resolve ``` And `iwraper.cs:WrapAssync` was only considering Linux `ECANCELED` thus causing a rise of an `Efl.FutureException: Future failed` instead of the expected `TaskCanceledException` making fail at `TestEoAsyncMethods.test_async_cancel`: ``` [ RUN ] TestEoAsyncMethods.test_async_cancel [ ERROR ] AssertionException: Assertion failed: /Users/lucas/expertise/efl1/src/tests/efl_mono/EoPromises.cs:175 (test_async_cancel) AggregateException must have been TaskCanceledException at Test.Assert(Boolean res, String msg, Int32 line, String file, String member) in /Users/lucas/expertise/efl1/src/tests/efl_mono/TestUtils.cs:line 53 at TestSuite.TestEoAsyncMethods.<>c.<test_async_cancel>b__1_0(Exception x) in /Users/lucas/expertise/efl1/src/tests/efl_mono/EoPromises.cs:line 175 at System.AggregateException.Handle(Func`2 predicate) at TestSuite.TestEoAsyncMethods.test_async_cancel() in /Users/lucas/expertise/efl1/src/tests/efl_mono/EoPromises.cs:line 171 [ FAIL ] TestEoAsyncMethods.test_async_cancel ``` Depends on D12156 Test Plan: Compare with master and note that with this diff all tests pass. - Configure as especified by Enlightenment man page + `-Dbindigns=mono -Ddotnet=true`: ``` meson -Dsystemd=false -Dv4l2=false -Davahi=false -Deeze=false -Dx11=false -Dopengl=full -Dcocoa=true -Dnls=false -Demotion-loaders-disabler=gstreamer1,libvlc,xine -Decore-imf-loaders-disabler=scim,ibus -Dbindigns=cxx,mono -Ddotnet=true build ``` - Build normally - Test `efl-mono-suite` Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: ProhtMeyhet, cedric, #reviewers, #committers, woohyun Tags: #efl Differential Revision: https://phab.enlightenment.org/D12157
-rw-r--r--src/bindings/mono/eina_mono/eina_error.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/bindings/mono/eina_mono/eina_error.cs b/src/bindings/mono/eina_mono/eina_error.cs
index 1300e796ab..004792fdb7 100644
--- a/src/bindings/mono/eina_mono/eina_error.cs
+++ b/src/bindings/mono/eina_mono/eina_error.cs
@@ -59,11 +59,27 @@ public struct Error : IComparable<Error>, IEquatable<Error>
59 /// <para>Since EFL 1.23.</para> 59 /// <para>Since EFL 1.23.</para>
60 /// </summary> 60 /// </summary>
61 public static readonly Error ENOENT = new Error(2); 61 public static readonly Error ENOENT = new Error(2);
62
63 /// <summary>
64 /// Return architecture independent ECANCELED error code.
65 /// Returns 125 for Linux, 89 for OSX and 105 for Windows.
66 /// <para>Since EFL 1.25.</para>
67 /// </summary>
68 private static int IndependentECANCELED()
69 {
70 if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
71 return new Error(125);
72 else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
73 return new Error(89);
74 else // Windows
75 return new Error(105);
76 }
77
62 /// <summary> 78 /// <summary>
63 /// Cancelled error identifier. 79 /// Cancelled error identifier.
64 /// <para>Since EFL 1.23.</para> 80 /// <para>Since EFL 1.23.</para>
65 /// </summary> 81 /// </summary>
66 public static readonly Error ECANCELED = new Error(125); 82 public static readonly Error ECANCELED = IndependentECANCELED();
67 83
68 /// <summary> 84 /// <summary>
69 /// Constructor. 85 /// Constructor.