Page MenuHomePhabricator

eio: add test to ensure proper lifecycle of Efl_Io object and futures.
ClosedPublic

Authored by cedric on Mar 15 2019, 5:01 PM.

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cedric created this revision.Mar 15 2019, 5:01 PM
bu5hm4n requested changes to this revision.Mar 16 2019, 9:03 AM

Well, this is a nice test. However, could we check that this prints no error ? :)

This revision now requires changes to proceed.Mar 16 2019, 9:03 AM

Well, this is a nice test. However, could we check that this prints no error ? :)

What message do you get???

I was more talking about adding DISABLE_ABORT_ON_CRITICAL_START; DISABLE_ABORT_ON_CRITICAL_END; to the test, so we ensure this test is not starting to print error messages.

I was more talking about adding DISABLE_ABORT_ON_CRITICAL_START; DISABLE_ABORT_ON_CRITICAL_END; to the test, so we ensure this test is not starting to print error messages.

I have no idea what you are talking about. Can you point to another piece of code that does implement this?

EFL_START_TEST(efl_destructor_unref)
{
   eina_log_print_cb_set(eo_test_print_cb, &ctx);

   static Efl_Class_Description class_desc = {
        EO_VERSION,
        "Simple",
        EFL_CLASS_TYPE_REGULAR,
        0,
        _destructor_unref_class_initializer,
        NULL,
        NULL
   };

   klass = efl_class_new(&class_desc, SIMPLE_CLASS, NULL);
   fail_if(!klass);

   Eo *obj = efl_add_ref(klass, NULL);
   fail_if(!obj);

   DISABLE_ABORT_ON_CRITICAL_START;
   TEST_EO_ERROR("efl_unref", "Obj:%s@%p. User refcount (%d) < 0. Too many unrefs.");
   efl_unref(obj);
   DISABLE_ABORT_ON_CRITICAL_END;

   eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);

}
EFL_END_TEST

Hum, this test should really not generate error. Like if it print a message, there is a problem that need fixing. I am not sure what the point of those macro would be in this context.

The macro ensures that the test case fails when there is a ERR.

The macro ensures that the test case fails when there is a ERR.

Ah!

Why don't you use EINA_LOG_ABORT and EINA_LOG_ABORT_LEVEL?

EINA_LOG_ABORT=1 EINA_LOG_ABORT_LEVEL=4 make check

@YOhoho There are testcases that are designed to error. Like those which are testing that a function really fails and gives a error in some cases. Hence we need to have that in the testcases themself :)

cedric planned changes to this revision.Mar 20 2019, 10:58 AM
cedric updated this revision to Diff 20816.Mar 20 2019, 11:37 AM

Rebase and correct.

bu5hm4n accepted this revision.Mar 21 2019, 2:32 AM
This revision is now accepted and ready to land.Mar 21 2019, 2:32 AM
cedric updated this revision to Diff 21003.Mar 27 2019, 2:41 PM

Rebase.

Closed by commit rEFLe162ba9696cb: eio: add test to ensure proper lifecycle of Efl_Io object and futures. (authored by Yeongjong Lee <yj34.lee@samsung.com>, committed by cedric). · Explain WhyMar 27 2019, 3:06 PM
This revision was automatically updated to reflect the committed changes.