diff options
author | Larry Jr <larry.olj@gmail.com> | 2018-03-20 19:10:34 -0300 |
---|---|---|
committer | Larry Jr <larry.olj@gmail.com> | 2018-04-12 17:21:09 -0300 |
commit | 0e3f799a797e3d99af043bf41491966787ab787f (patch) | |
tree | ef70e415de12c29e45168774fa53154b1f0f6109 | |
parent | ce2e4a48258a7feefa77ca9c3ef7151e3b5e95a0 (diff) | |
download | efl-0e3f799a797e3d99af043bf41491966787ab787f.tar.gz |
eolian: pyolian automated ecore and ector [WIP]
-rw-r--r-- | src/Makefile_Automated.am | 28 | ||||
-rwxr-xr-x | src/scripts/pyolian/testgenerator.py | 6 | ||||
-rw-r--r-- | src/scripts/pyolian/testgenerator_suite.template | 13 | ||||
-rw-r--r-- | src/tests/automated/ector_custom.c | 3 | ||||
-rw-r--r-- | src/tests/automated/ector_init.c | 1 | ||||
-rw-r--r-- | src/tests/automated/ector_shutdown.c | 1 | ||||
-rw-r--r-- | src/tests/automated/efl_loop/begin/init.c | 8 | ||||
-rw-r--r-- | src/tests/automated/efl_loop/begin/shutdown.c | 3 | ||||
-rw-r--r-- | src/tests/automated/efl_loop/custom.c | 5 | ||||
-rw-r--r-- | src/tests/automated/efl_loop/init.c | 1 | ||||
-rw-r--r-- | src/tests/automated/efl_loop/timeout/arg_init.c | 1 |
11 files changed, 60 insertions, 10 deletions
diff --git a/src/Makefile_Automated.am b/src/Makefile_Automated.am index 7b9f62f791..ec9b4322aa 100644 --- a/src/Makefile_Automated.am +++ b/src/Makefile_Automated.am @@ -1,19 +1,37 @@ if EFL_ENABLE_TESTS -TEST_GEN=$(top_srcdir)/src/scripts/pyolian/testgenerator.py -ecore_automated_suite = $(top_builddir)/src/tests/automated/ecore_suite_automated.c +AM_TESTS_ENVIRONMENT += EOLIAN_SO_DIR='$(top_builddir)/src/lib/eolian/.libs/' +TEST_GEN = $(top_srcdir)/src/scripts/pyolian/testgenerator.py -tests/automated/ecore_suite_automated.c: +ecore_automated_source = tests/automated/ecore_suite_automated.c +ecore_automated_suite = $(top_builddir)/src/$(ecore_automated_source) +$(ecore_automated_source): $(TEST_GEN) automated ecore $(top_builddir)/src/$@ $(ecore_eolian_files) check_PROGRAMS += tests/automated/ecore_suite_automated TESTS += tests/automated/ecore_suite_automated -tests_automated_ecore_suite_automated_SOURCE = tests/automated/ecore_suite_automated.c +tests_automated_ecore_suite_automated_SOURCE = $(ecore_automated_source) tests_automated_ecore_suite_automated_CPPFLAGS = $(tests_ecore_ecore_suite_CPPFLAGS) \ -I$(top_srcdir)/src/tests \ @ELEMENTARY_CFLAGS@ -tests_automated_ecore_suite_automated_LDADD = $(tests_ecore_ecore_suite_LDADD) +tests_automated_ecore_suite_automated_LDADD = $(tests_ecore_ecore_suite_LDADD) @USE_ELEMENTARY_LIBS@ + + +ector_automated_source = tests/automated/ector_suite_automated.c +ector_automated_suite = $(top_builddir)/src/$(ector_automated_source) +$(ector_automated_source): + $(TEST_GEN) automated ector $(top_builddir)/src/$@ $(ector_eolian_files) + +check_PROGRAMS += tests/automated/ector_suite_automated +TESTS += tests/automated/ector_suite_automated + +tests_automated_ector_suite_automated_SOURCE = $(ector_automated_source) +tests_automated_ector_suite_automated_CPPFLAGS = $(tests_ector_suite_ector_suite_CPPFLAGS) \ +-I$(top_srcdir)/src/tests \ +@ELEMENTARY_CFLAGS@ +tests_automated_ector_suite_automated_LDADD = $(tests_ector_suite_ector_suite_LDADD) @USE_ECORE_LIBS@ +tests_automated_ector_suite_automated_DEPENDENCIES = @USE_ECTOR_INTERNAL_LIBS@ endif diff --git a/src/scripts/pyolian/testgenerator.py b/src/scripts/pyolian/testgenerator.py index 0ff84df240..e750fa972d 100755 --- a/src/scripts/pyolian/testgenerator.py +++ b/src/scripts/pyolian/testgenerator.py @@ -109,14 +109,14 @@ class SuiteCase(): def load(self, testdir, eofiles): self.clslist = [] + self.custom = load_file(os.path.join(testdir, "{}_custom.c".format(self.name))) or '' + self.init = load_file(os.path.join(testdir, "{}_init.c".format(self.name))) or '' + self.shutdown = load_file(os.path.join(testdir, "{}_shutdown.c".format(self.name))) or '' for eofile in eofiles: cls = eolian_db.class_by_file_get(os.path.basename(eofile)) if not cls or cls.type != cls.type.REGULAR: continue - if cls.file == "efl_promise.eo": - continue - self.clslist.append(cls) cls.myname = os.path.splitext(cls.file)[0] cls.myfullname = "{}_{}".format(self.fullname, cls.myname) diff --git a/src/scripts/pyolian/testgenerator_suite.template b/src/scripts/pyolian/testgenerator_suite.template index 19f7ebf297..340cef441d 100644 --- a/src/scripts/pyolian/testgenerator_suite.template +++ b/src/scripts/pyolian/testgenerator_suite.template @@ -1,15 +1,19 @@ <!--(macro init)--> /** init **/ + Eo *parent = NULL; + Eo *obj = NULL; + fail_if(!eina_init(), "ERROR: Cannot init Eina!\n"); fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n"); fail_if(!efl_object_init(), "ERROR: Cannot init EO!\n"); + ${suite.init}$ <!--(if exists("mfunc") and mfunc!= None)--> ${mfunc}$ <!--(elif exists("mcls") and mcls!= None)--> ${mcls}$ <!--(else)--> - Eo *obj = efl_add(${cls.c_name}$, NULL); + obj = efl_add(${cls.c_name}$, parent); fail_if(!obj, "ERROR: Cannot init ${cls.name}$!\n"); <!--(end)--> <!--(end)--> @@ -21,12 +25,16 @@ ${mcls}$ <!--(end)--> efl_unref(obj); + ${suite.shutdown}$ ecore_shutdown(); eina_shutdown(); <!--(end)--> +<!--(macro arg_default)--> + <!--(if arg.type.name == "__builtin_free_cb" or arg.type.is_ptr or arg.type.type == arg.type.type.CLASS or arg.type.builtin_type == arg.type.builtin_type.STRING)-->NULL<!--(elif arg.type.builtin_type == arg.type.builtin_type.ANY_VALUE)-->EINA_VALUE_EMPTY<!--(elif arg.type.name == 'Eina.Slice')-->{}<!--(else)-->0<!--(end)-->; +<!--(end)--> <!--(macro args_declaration)--> <!--(for arg in args)--> - ${arg.type.c_type_return}$ arg_${arg.name}$ = <!--(if arg.type.is_ptr or arg.type.type == arg.type.type.CLASS or arg.type.builtin_type == arg.type.builtin_type.STRING)-->NULL<!--(elif arg.type.builtin_type == arg.type.builtin_type.ANY_VALUE)-->EINA_VALUE_EMPTY<!--(elif arg.type.name == 'Eina.Slice')-->{}<!--(else)-->0<!--(end)-->; + ${arg.type.c_type_return}$ arg_${arg.name}$ = ${arg_default(arg=arg)}$ <!--(end)--> <!--(end)--> <!--(macro print_arg)--> @@ -41,6 +49,7 @@ #include "efl_check.h" #include <Elementary.h> +${suite.custom}$ <!--(for cls in suite.clslist)--> void ${cls.myfullname}$_test(TCase *tc); diff --git a/src/tests/automated/ector_custom.c b/src/tests/automated/ector_custom.c new file mode 100644 index 0000000000..0ff115b738 --- /dev/null +++ b/src/tests/automated/ector_custom.c @@ -0,0 +1,3 @@ +#include <cairo/Ector_Cairo.h> +#include <software/Ector_Software.h> +#include <gl/Ector_GL.h> diff --git a/src/tests/automated/ector_init.c b/src/tests/automated/ector_init.c new file mode 100644 index 0000000000..bb6acb6fd0 --- /dev/null +++ b/src/tests/automated/ector_init.c @@ -0,0 +1 @@ +fail_if(!ector_init(), "ERROR: Cannot init Ector!\n"); diff --git a/src/tests/automated/ector_shutdown.c b/src/tests/automated/ector_shutdown.c new file mode 100644 index 0000000000..523ed55e66 --- /dev/null +++ b/src/tests/automated/ector_shutdown.c @@ -0,0 +1 @@ +ector_shutdown(); diff --git a/src/tests/automated/efl_loop/begin/init.c b/src/tests/automated/efl_loop/begin/init.c new file mode 100644 index 0000000000..5bf1c5e8cc --- /dev/null +++ b/src/tests/automated/efl_loop/begin/init.c @@ -0,0 +1,8 @@ +int argc = 2; +char *argv[] = { "efl_ui_suite", "test" }; + +_EFL_APP_VERSION_SET(); +obj = efl_app_get(); +efl_event_callback_add(obj, EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); +fail_if(!ecore_init_ex(argc, argv)); +__EFL_MAIN_CONSTRUCTOR; diff --git a/src/tests/automated/efl_loop/begin/shutdown.c b/src/tests/automated/efl_loop/begin/shutdown.c new file mode 100644 index 0000000000..1f578789d4 --- /dev/null +++ b/src/tests/automated/efl_loop/begin/shutdown.c @@ -0,0 +1,3 @@ +efl_loop_exit_code_process(r); +__EFL_MAIN_DESTRUCTOR; +ecore_shutdown_ex(); diff --git a/src/tests/automated/efl_loop/custom.c b/src/tests/automated/efl_loop/custom.c new file mode 100644 index 0000000000..f7df130584 --- /dev/null +++ b/src/tests/automated/efl_loop/custom.c @@ -0,0 +1,5 @@ +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev) +{ + efl_loop_quit(ev->object, EINA_VALUE_EMPTY); +} diff --git a/src/tests/automated/efl_loop/init.c b/src/tests/automated/efl_loop/init.c new file mode 100644 index 0000000000..a9fe42a143 --- /dev/null +++ b/src/tests/automated/efl_loop/init.c @@ -0,0 +1 @@ + obj = efl_add_ref(EFL_LOOP_CLASS, parent); diff --git a/src/tests/automated/efl_loop/timeout/arg_init.c b/src/tests/automated/efl_loop/timeout/arg_init.c new file mode 100644 index 0000000000..e2e28fb725 --- /dev/null +++ b/src/tests/automated/efl_loop/timeout/arg_init.c @@ -0,0 +1 @@ + arg_time = 0.5; |