aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2018-03-19 19:44:33 -0300
committerLarry Jr <larry.olj@gmail.com>2018-04-12 17:21:09 -0300
commitce2e4a48258a7feefa77ca9c3ef7151e3b5e95a0 (patch)
tree2d94b1442859a151f93c61b228e48a39fe450f9f
parenteolian: testgenerator using pyolian WIP (diff)
downloadefl-ce2e4a48258a7feefa77ca9c3ef7151e3b5e95a0.tar.gz
testgenerator using pyolian fixed makefile.am and compilations tests WIP
-rw-r--r--src/Makefile_Automated.am8
-rwxr-xr-xsrc/scripts/pyolian/testgenerator.py14
-rw-r--r--src/scripts/pyolian/testgenerator_suite.template27
3 files changed, 29 insertions, 20 deletions
diff --git a/src/Makefile_Automated.am b/src/Makefile_Automated.am
index c9bf148413..7b9f62f791 100644
--- a/src/Makefile_Automated.am
+++ b/src/Makefile_Automated.am
@@ -4,14 +4,16 @@ TEST_GEN=$(top_srcdir)/src/scripts/pyolian/testgenerator.py
ecore_automated_suite = $(top_builddir)/src/tests/automated/ecore_suite_automated.c
tests/automated/ecore_suite_automated.c:
- $(TEST_GEN) automated ecore $(ecore_automated_suite) $(ecore_eolian_files)
+ $(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_CPPFLAGS = $(tests_ecore_ecore_suite_CPPFLAGS)
-tests_automated_ecore_suite_automated_LDADD = tests_ecore_ecore_suite_LDADD
+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)
endif
diff --git a/src/scripts/pyolian/testgenerator.py b/src/scripts/pyolian/testgenerator.py
index af189bd1dc..0ff84df240 100755
--- a/src/scripts/pyolian/testgenerator.py
+++ b/src/scripts/pyolian/testgenerator.py
@@ -133,16 +133,16 @@ class SuiteCase():
func.arg_init = load_file(os.path.join(filedir, func.name, "arg_init.c")) or "/* Zero/NULL args init */"
func.arg_shutdown = load_file(os.path.join(filedir, func.name, "arg_shutdown.c")) or "/* Zero/NULL args shutdown */"
- cls.plist = [ p for p in cls.properties if p.getter_scope or p.setter_scope ]
+ cls.plist = [ p for p in cls.properties if p.getter_scope == p.getter_scope.PUBLIC or p.setter_scope == p.setter_scope.PUBLIC ]
for func in cls.plist:
- if func.getter_scope:
+ if func.getter_scope == func.getter_scope.PUBLIC:
cls.custom += load_file(os.path.join(filedir, '{}_get'.format(func.name), "custom.c")) or ""
func.get_init = load_file(os.path.join(filedir, '{}_get'.format(func.name), "init.c"))
func.get_shutdown = load_file(os.path.join(filedir, '{}_get'.format(func.name), "shutdown.c"))
func.arg_get_init = load_file(os.path.join(filedir, '{}_get'.format(func.name), "arg_init.c")) or "/* Zero/NULL args getter init */"
func.arg_get_shutdown = load_file(os.path.join(filedir, '{}_set'.format(func.name), "arg_shutdown.c")) or "/* Zero/NULL args getter shutdown */"
- if func.setter_scope:
+ if func.setter_scope == func.setter_scope.PUBLIC:
cls.custom += load_file(os.path.join(filedir, '{}_set'.format(func.name), "custom.c")) or ""
func.set_init = load_file(os.path.join(filedir, '{}_set'.format(func.name), "init.c"))
func.set_shutdown = load_file(os.path.join(filedir, '{}_set'.format(func.name), "shutdown.c"))
@@ -167,7 +167,7 @@ if __name__ == '__main__':
suite.load(testdir, args.eofiles)
t = Template(suite.template)
- try:
- t.render(suite)
- except:
- print("ERROR RENDERING - Cannot create file: {}".format(suite.filename))
+# try:
+ t.render(suite)
+# except:
+# print("ERROR RENDERING - Cannot create file: {}".format(suite.filename))
diff --git a/src/scripts/pyolian/testgenerator_suite.template b/src/scripts/pyolian/testgenerator_suite.template
index d386803d75..19f7ebf297 100644
--- a/src/scripts/pyolian/testgenerator_suite.template
+++ b/src/scripts/pyolian/testgenerator_suite.template
@@ -3,7 +3,6 @@
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");
- fail_if(!eio_init(), "ERROR: Cannot init EIO!\n");
<!--(if exists("mfunc") and mfunc!= None)-->
${mfunc}$
@@ -22,21 +21,27 @@
${mcls}$
<!--(end)-->
efl_unref(obj);
- eio_shutdown();
ecore_shutdown();
eina_shutdown();
<!--(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<!--(else)-->0<!--(end)-->;
+ ${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)-->;
<!--(end)-->
<!--(end)-->
+<!--(macro print_arg)-->
+ <!--(if arg.direction == arg.direction.OUT)-->&<!--(end)-->arg_${arg.name}$
+<!--(end)-->
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <check.h>
+#include "efl_check.h"
+#include <Elementary.h>
+
<!--(for cls in suite.clslist)-->
void ${cls.myfullname}$_test(TCase *tc);
<!--(end)-->
@@ -67,7 +72,8 @@ START_TEST(${cls.myfullname}$_${func.full_c_method_name}$)
{
${args_declaration(args=func.parameters)}$${init(mcls=cls.init,mfunc=func.init)}$
${func.arg_init}$
- <!--(if func.method_return_type)-->${func.method_return_type.c_type_return}$ r = <!--(end)-->${func.full_c_method_name}$(obj<!--(for arg in func.parameters)-->, arg_${arg.name}$<!--(end)-->);
+ <!--(if func.method_return_type)-->${func.method_return_type.c_type_return}$ r = <!--(end)-->${func.full_c_method_name}$(obj<!--(for arg in func.parameters)-->,${print_arg(arg=arg)}$<!--(end)-->);
+ <!--(if func.method_return_type)-->(void)r;<!--(end)-->
${func.arg_shutdown}$
${shutdown(mcls=cls.shutdown,mfunc=func.shutdown)}$
}
@@ -76,7 +82,7 @@ END_TEST
<!--(end)-->
<!--(for func in cls.plist)-->
- <!--(if func.getter_scope)-->
+ <!--(if func.getter_scope == func.getter_scope.PUBLIC)-->
START_TEST(${cls.myfullname}$_${func.full_c_getter_name}$)
{
<!--(if len(list(func.getter_values)) > 1)-->
@@ -85,7 +91,8 @@ ${args_declaration(args=func.getter_values)}$
${args_declaration(args=func.getter_keys)}$${init(mcls=cls.init,mfunc=func.get_init)}$
${func.arg_get_init}$
<!--(if len(list(func.getter_values)) == 1)-->
- ${list(func.getter_values)[0].type.c_type_return}$ r = ${func.full_c_getter_name}$(obj<!--(for arg in func.getter_keys)-->arg_${arg.name}$<!--(end)-->);
+ ${list(func.getter_values)[0].type.c_type_return}$ r = ${func.full_c_getter_name}$(obj<!--(for arg in func.getter_keys)-->, arg_${arg.name}$<!--(end)-->);
+ (void)r;
<!--(else)-->
${func.full_c_getter_name}$(obj<!--(for arg in func.getter_values)-->, &arg_${arg.name}$<!--(end)--><!--(for arg in func.getter_keys)-->, arg_${arg.name}$<!--(end)-->);
<!--(end)-->
@@ -95,12 +102,12 @@ ${shutdown(mcustom=cls.shutdown,mfunc=func.get_shutdown)}$
END_TEST
<!--(end)-->
- <!--(if func.setter_scope)-->
+ <!--(if func.setter_scope == func.setter_scope.PUBLIC)-->
START_TEST(${cls.myfullname}$_${func.full_c_setter_name}$)
{
${args_declaration(args=func.setter_keys)}$${args_declaration(args=func.setter_values)}$${init(mcls=cls.init,mfunc=func.set_init)}$
${func.arg_set_init}$
- ${func.full_c_getter_name}$(obj<!--(for arg in func.setter_values)-->, &arg_${arg.name}$<!--(end)--><!--(for arg in func.setter_keys)-->, arg_${arg.name}$<!--(end)-->);
+ ${func.full_c_setter_name}$(obj<!--(for arg in func.setter_keys)-->, arg_${arg.name}$<!--(end)--><!--(for arg in func.setter_values)-->, arg_${arg.name}$<!--(end)-->);
${func.arg_set_shutdown}$
${shutdown(mcls=cls.shutdown,mfunc=func.set_shutdown)}$
}
@@ -116,10 +123,10 @@ void ${cls.myfullname}$_test(TCase *tc)
tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_method_name}$);
<!--(end)-->
<!--(for func in cls.properties)-->
- <!--(if func.getter_scope)-->
+ <!--(if func.getter_scope == func.getter_scope.PUBLIC)-->
tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_getter_name}$);
<!--(end)-->
- <!--(if func.setter_scope)-->
+ <!--(if func.setter_scope == func.setter_scope.PUBLIC)-->
tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_setter_name}$);
<!--(end)-->
<!--(end)-->