Re: [E-devel] [EGIT] [core/efl] master 01/01: eo_test_general.c: Make eo_signals tests pass on Windows

2020-11-05 Thread Carsten Haitzler
On Thu, 5 Nov 2020 09:49:43 +0100 Marcel Hollerbach  said:

actually good point. maybe i should back this out.

> Hi,
> 
> this looks kind of wrong to me:
> 
> 1. If you speak about the nondeterministic nature of the addresses of 
> the events being different: That does not matter, the order of the event 
> subscriptions within the array of different events do not matter. Only 
> the order of the subscriptions of the same event do matter. This is 
> coming from the fact that we are only "using" the resulting order of all 
> subscriptions by its history, not by its address.
> 
> 
> 2. If you speak about the fact that we rely on the same events in the 
> array keeping the same order, and there is behavior in the windows qsort 
> implementation that is breaking our assertions, then this needs to be 
> fixed in the EFL_CALLBACKS_ARRAY_DEFINE macro, otherwise every single 
> user gets the wrong behavior. Which has (exactly in this spot) caused 
> apps to not even start in the past. (There was a discussion in the past 
> about the fact that qsort does not have documented defined behavior for 
> maintaining order of equal event, however, there is some black magic we 
> could apply to get that, with rather low memory/perf impact)
> 
> Greetings,
> bu5hm4n
> 
> 
> 
> On 11/4/20 7:56 PM, Wander Lairson Costa wrote:
> > raster pushed a commit to branch master.
> > 
> > http://git.enlightenment.org/core/efl.git/commit/?id=fc949660f70f99fe97e63de65b1b67377d16c6da
> > 
> > commit fc949660f70f99fe97e63de65b1b67377d16c6da
> > Author: Wander Lairson Costa 
> > Date:   Wed Nov 4 18:25:37 2020 +
> > 
> >  eo_test_general.c: Make eo_signals tests pass on Windows
> >  
> >  Summary:
> >  EFL_CALLBACKS_ARRAY_DEFINE reorders the callbacks according to
> >  efl_callbacks_cmp. efl_callbacks_cmp compares the address of the desc
> >  field, which depends on the memory layout generated by the linker.
> >  
> >  To make the test run deterministically, we define the array of
> > callbacks manually.
> >  
> >  Reviewers: vtorri, felipealmeida, raster
> >  
> >  Reviewed By: raster
> >  
> >  Subscribers: cedric, #reviewers, #committers, jptiz, felipealmeida
> >  
> >  Tags: #efl
> >  
> >  Differential Revision: https://phab.enlightenment.org/D12043
> > ---
> >   src/tests/eo/suite/eo_test_general.c | 25 -
> >   1 file changed, 20 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/tests/eo/suite/eo_test_general.c
> > b/src/tests/eo/suite/eo_test_general.c index ae026a27f4..7bdb0e170b 100644
> > --- a/src/tests/eo/suite/eo_test_general.c
> > +++ b/src/tests/eo/suite/eo_test_general.c
> > @@ -199,11 +199,26 @@ _eo_signals_cb_added_deled(void *data EINA_UNUSED,
> > const Efl_Event *event) fail_if(callback_array->func !=
> > _eo_signals_cb_added_deled); }
> >   
> > -EFL_CALLBACKS_ARRAY_DEFINE(_eo_signals_callbacks,
> > -{ EV_A_CHANGED, _eo_signals_a_changed_cb },
> > -{ EV_A_CHANGED, _eo_signals_a_changed_cb2 },
> > -{ EV_A_CHANGED, _eo_signals_a_changed_never },
> > -{ EFL_EVENT_DEL, _eo_signals_efl_del_cb });
> > +// We don't use the EFL_CALLBACKS_ARRAY_DEFINE macro because
> > +// we need the callbacks be called in a specific order
> > +static Efl_Callback_Array_Item *
> > +_eo_signals_callbacks(void)
> > +{
> > +static Efl_Callback_Array_Item items[] =
> > +  {
> > +  { EV_A_CHANGED, _eo_signals_a_changed_cb },
> > +  { EV_A_CHANGED, _eo_signals_a_changed_cb2 },
> > +  { EV_A_CHANGED, _eo_signals_a_changed_never },
> > +  { 0, _eo_signals_efl_del_cb },
> > +  { 0, 0 },
> > +  };
> > +
> > +// On Windows, because _EFL_EVENT_DEL is a symbol exported
> > +// from the DLL, we can't assign from a context expression
> > +items[3].desc = EFL_EVENT_DEL;
> > +
> > +return items;
> > +}
> >   
> >   EFL_START_TEST(eo_signals)
> >   {
> > 
> 
> 
> ___
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
- Codito, ergo sum - "I code, therefore I am" --
Carsten Haitzler - ras...@rasterman.com



___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [EGIT] [core/efl] master 01/01: eo_test_general.c: Make eo_signals tests pass on Windows

2020-11-05 Thread Marcel Hollerbach

Hi,

this looks kind of wrong to me:

1. If you speak about the nondeterministic nature of the addresses of 
the events being different: That does not matter, the order of the event 
subscriptions within the array of different events do not matter. Only 
the order of the subscriptions of the same event do matter. This is 
coming from the fact that we are only "using" the resulting order of all 
subscriptions by its history, not by its address.



2. If you speak about the fact that we rely on the same events in the 
array keeping the same order, and there is behavior in the windows qsort 
implementation that is breaking our assertions, then this needs to be 
fixed in the EFL_CALLBACKS_ARRAY_DEFINE macro, otherwise every single 
user gets the wrong behavior. Which has (exactly in this spot) caused 
apps to not even start in the past. (There was a discussion in the past 
about the fact that qsort does not have documented defined behavior for 
maintaining order of equal event, however, there is some black magic we 
could apply to get that, with rather low memory/perf impact)


Greetings,
   bu5hm4n



On 11/4/20 7:56 PM, Wander Lairson Costa wrote:

raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fc949660f70f99fe97e63de65b1b67377d16c6da

commit fc949660f70f99fe97e63de65b1b67377d16c6da
Author: Wander Lairson Costa 
Date:   Wed Nov 4 18:25:37 2020 +

 eo_test_general.c: Make eo_signals tests pass on Windows
 
 Summary:

 EFL_CALLBACKS_ARRAY_DEFINE reorders the callbacks according to
 efl_callbacks_cmp. efl_callbacks_cmp compares the address of the desc
 field, which depends on the memory layout generated by the linker.
 
 To make the test run deterministically, we define the array of callbacks

 manually.
 
 Reviewers: vtorri, felipealmeida, raster
 
 Reviewed By: raster
 
 Subscribers: cedric, #reviewers, #committers, jptiz, felipealmeida
 
 Tags: #efl
 
 Differential Revision: https://phab.enlightenment.org/D12043

---
  src/tests/eo/suite/eo_test_general.c | 25 -
  1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/tests/eo/suite/eo_test_general.c 
b/src/tests/eo/suite/eo_test_general.c
index ae026a27f4..7bdb0e170b 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -199,11 +199,26 @@ _eo_signals_cb_added_deled(void *data EINA_UNUSED, const 
Efl_Event *event)
   fail_if(callback_array->func != _eo_signals_cb_added_deled);
  }
  
-EFL_CALLBACKS_ARRAY_DEFINE(_eo_signals_callbacks,

-{ EV_A_CHANGED, _eo_signals_a_changed_cb },
-{ EV_A_CHANGED, _eo_signals_a_changed_cb2 },
-{ EV_A_CHANGED, _eo_signals_a_changed_never },
-{ EFL_EVENT_DEL, _eo_signals_efl_del_cb });
+// We don't use the EFL_CALLBACKS_ARRAY_DEFINE macro because
+// we need the callbacks be called in a specific order
+static Efl_Callback_Array_Item *
+_eo_signals_callbacks(void)
+{
+static Efl_Callback_Array_Item items[] =
+  {
+  { EV_A_CHANGED, _eo_signals_a_changed_cb },
+  { EV_A_CHANGED, _eo_signals_a_changed_cb2 },
+  { EV_A_CHANGED, _eo_signals_a_changed_never },
+  { 0, _eo_signals_efl_del_cb },
+  { 0, 0 },
+  };
+
+// On Windows, because _EFL_EVENT_DEL is a symbol exported
+// from the DLL, we can't assign from a context expression
+items[3].desc = EFL_EVENT_DEL;
+
+return items;
+}
  
  EFL_START_TEST(eo_signals)

  {




___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel