summaryrefslogtreecommitdiff
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
parent041f0abe19807a2dee3454b75facad5c5e58874a (diff)
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
4ecore_automated_suite = $(top_builddir)/src/tests/automated/ecore_suite_automated.c 4ecore_automated_suite = $(top_builddir)/src/tests/automated/ecore_suite_automated.c
5 5
6tests/automated/ecore_suite_automated.c: 6tests/automated/ecore_suite_automated.c:
7 $(TEST_GEN) automated ecore $(ecore_automated_suite) $(ecore_eolian_files) 7 $(TEST_GEN) automated ecore $(top_builddir)/src/$@ $(ecore_eolian_files)
8 8
9check_PROGRAMS += tests/automated/ecore_suite_automated 9check_PROGRAMS += tests/automated/ecore_suite_automated
10TESTS += tests/automated/ecore_suite_automated 10TESTS += tests/automated/ecore_suite_automated
11 11
12tests_automated_ecore_suite_automated_SOURCE = tests/automated/ecore_suite_automated.c 12tests_automated_ecore_suite_automated_SOURCE = tests/automated/ecore_suite_automated.c
13tests_automated_ecore_suite_automated_CPPFLAGS = $(tests_ecore_ecore_suite_CPPFLAGS) 13tests_automated_ecore_suite_automated_CPPFLAGS = $(tests_ecore_ecore_suite_CPPFLAGS) \
14tests_automated_ecore_suite_automated_LDADD = tests_ecore_ecore_suite_LDADD 14-I$(top_srcdir)/src/tests \
15@ELEMENTARY_CFLAGS@
16tests_automated_ecore_suite_automated_LDADD = $(tests_ecore_ecore_suite_LDADD)
15 17
16endif 18endif
17 19
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():
133 func.arg_init = load_file(os.path.join(filedir, func.name, "arg_init.c")) or "/* Zero/NULL args init */" 133 func.arg_init = load_file(os.path.join(filedir, func.name, "arg_init.c")) or "/* Zero/NULL args init */"
134 func.arg_shutdown = load_file(os.path.join(filedir, func.name, "arg_shutdown.c")) or "/* Zero/NULL args shutdown */" 134 func.arg_shutdown = load_file(os.path.join(filedir, func.name, "arg_shutdown.c")) or "/* Zero/NULL args shutdown */"
135 135
136 cls.plist = [ p for p in cls.properties if p.getter_scope or p.setter_scope ] 136 cls.plist = [ p for p in cls.properties if p.getter_scope == p.getter_scope.PUBLIC or p.setter_scope == p.setter_scope.PUBLIC ]
137 for func in cls.plist: 137 for func in cls.plist:
138 if func.getter_scope: 138 if func.getter_scope == func.getter_scope.PUBLIC:
139 cls.custom += load_file(os.path.join(filedir, '{}_get'.format(func.name), "custom.c")) or "" 139 cls.custom += load_file(os.path.join(filedir, '{}_get'.format(func.name), "custom.c")) or ""
140 func.get_init = load_file(os.path.join(filedir, '{}_get'.format(func.name), "init.c")) 140 func.get_init = load_file(os.path.join(filedir, '{}_get'.format(func.name), "init.c"))
141 func.get_shutdown = load_file(os.path.join(filedir, '{}_get'.format(func.name), "shutdown.c")) 141 func.get_shutdown = load_file(os.path.join(filedir, '{}_get'.format(func.name), "shutdown.c"))
142 func.arg_get_init = load_file(os.path.join(filedir, '{}_get'.format(func.name), "arg_init.c")) or "/* Zero/NULL args getter init */" 142 func.arg_get_init = load_file(os.path.join(filedir, '{}_get'.format(func.name), "arg_init.c")) or "/* Zero/NULL args getter init */"
143 func.arg_get_shutdown = load_file(os.path.join(filedir, '{}_set'.format(func.name), "arg_shutdown.c")) or "/* Zero/NULL args getter shutdown */" 143 func.arg_get_shutdown = load_file(os.path.join(filedir, '{}_set'.format(func.name), "arg_shutdown.c")) or "/* Zero/NULL args getter shutdown */"
144 144
145 if func.setter_scope: 145 if func.setter_scope == func.setter_scope.PUBLIC:
146 cls.custom += load_file(os.path.join(filedir, '{}_set'.format(func.name), "custom.c")) or "" 146 cls.custom += load_file(os.path.join(filedir, '{}_set'.format(func.name), "custom.c")) or ""
147 func.set_init = load_file(os.path.join(filedir, '{}_set'.format(func.name), "init.c")) 147 func.set_init = load_file(os.path.join(filedir, '{}_set'.format(func.name), "init.c"))
148 func.set_shutdown = load_file(os.path.join(filedir, '{}_set'.format(func.name), "shutdown.c")) 148 func.set_shutdown = load_file(os.path.join(filedir, '{}_set'.format(func.name), "shutdown.c"))
@@ -167,7 +167,7 @@ if __name__ == '__main__':
167 suite.load(testdir, args.eofiles) 167 suite.load(testdir, args.eofiles)
168 168
169 t = Template(suite.template) 169 t = Template(suite.template)
170 try: 170# try:
171 t.render(suite) 171 t.render(suite)
172 except: 172# except:
173 print("ERROR RENDERING - Cannot create file: {}".format(suite.filename)) 173# 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 @@
3 fail_if(!eina_init(), "ERROR: Cannot init Eina!\n"); 3 fail_if(!eina_init(), "ERROR: Cannot init Eina!\n");
4 fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n"); 4 fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n");
5 fail_if(!efl_object_init(), "ERROR: Cannot init EO!\n"); 5 fail_if(!efl_object_init(), "ERROR: Cannot init EO!\n");
6 fail_if(!eio_init(), "ERROR: Cannot init EIO!\n");
7 6
8 <!--(if exists("mfunc") and mfunc!= None)--> 7 <!--(if exists("mfunc") and mfunc!= None)-->
9 ${mfunc}$ 8 ${mfunc}$
@@ -22,21 +21,27 @@
22 ${mcls}$ 21 ${mcls}$
23 <!--(end)--> 22 <!--(end)-->
24 efl_unref(obj); 23 efl_unref(obj);
25 eio_shutdown();
26 ecore_shutdown(); 24 ecore_shutdown();
27 eina_shutdown(); 25 eina_shutdown();
28<!--(end)--> 26<!--(end)-->
29<!--(macro args_declaration)--> 27<!--(macro args_declaration)-->
30 <!--(for arg in args)--> 28 <!--(for arg in args)-->
31 ${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)-->; 29 ${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)-->;
32 <!--(end)--> 30 <!--(end)-->
33<!--(end)--> 31<!--(end)-->
32<!--(macro print_arg)-->
33 <!--(if arg.direction == arg.direction.OUT)-->&<!--(end)-->arg_${arg.name}$
34<!--(end)-->
35
34#ifdef HAVE_CONFIG_H 36#ifdef HAVE_CONFIG_H
35# include <config.h> 37# include <config.h>
36#endif 38#endif
37 39
38#include <check.h> 40#include <check.h>
39 41
42#include "efl_check.h"
43#include <Elementary.h>
44
40<!--(for cls in suite.clslist)--> 45<!--(for cls in suite.clslist)-->
41void ${cls.myfullname}$_test(TCase *tc); 46void ${cls.myfullname}$_test(TCase *tc);
42<!--(end)--> 47<!--(end)-->
@@ -67,7 +72,8 @@ START_TEST(${cls.myfullname}$_${func.full_c_method_name}$)
67{ 72{
68${args_declaration(args=func.parameters)}$${init(mcls=cls.init,mfunc=func.init)}$ 73${args_declaration(args=func.parameters)}$${init(mcls=cls.init,mfunc=func.init)}$
69${func.arg_init}$ 74${func.arg_init}$
70 <!--(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)-->); 75 <!--(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)-->);
76 <!--(if func.method_return_type)-->(void)r;<!--(end)-->
71${func.arg_shutdown}$ 77${func.arg_shutdown}$
72${shutdown(mcls=cls.shutdown,mfunc=func.shutdown)}$ 78${shutdown(mcls=cls.shutdown,mfunc=func.shutdown)}$
73} 79}
@@ -76,7 +82,7 @@ END_TEST
76 <!--(end)--> 82 <!--(end)-->
77 83
78 <!--(for func in cls.plist)--> 84 <!--(for func in cls.plist)-->
79 <!--(if func.getter_scope)--> 85 <!--(if func.getter_scope == func.getter_scope.PUBLIC)-->
80START_TEST(${cls.myfullname}$_${func.full_c_getter_name}$) 86START_TEST(${cls.myfullname}$_${func.full_c_getter_name}$)
81{ 87{
82 <!--(if len(list(func.getter_values)) > 1)--> 88 <!--(if len(list(func.getter_values)) > 1)-->
@@ -85,7 +91,8 @@ ${args_declaration(args=func.getter_values)}$
85${args_declaration(args=func.getter_keys)}$${init(mcls=cls.init,mfunc=func.get_init)}$ 91${args_declaration(args=func.getter_keys)}$${init(mcls=cls.init,mfunc=func.get_init)}$
86${func.arg_get_init}$ 92${func.arg_get_init}$
87 <!--(if len(list(func.getter_values)) == 1)--> 93 <!--(if len(list(func.getter_values)) == 1)-->
88 ${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)-->); 94 ${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)-->);
95 (void)r;
89 <!--(else)--> 96 <!--(else)-->
90 ${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)-->); 97 ${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)-->);
91 <!--(end)--> 98 <!--(end)-->
@@ -95,12 +102,12 @@ ${shutdown(mcustom=cls.shutdown,mfunc=func.get_shutdown)}$
95END_TEST 102END_TEST
96 103
97 <!--(end)--> 104 <!--(end)-->
98 <!--(if func.setter_scope)--> 105 <!--(if func.setter_scope == func.setter_scope.PUBLIC)-->
99START_TEST(${cls.myfullname}$_${func.full_c_setter_name}$) 106START_TEST(${cls.myfullname}$_${func.full_c_setter_name}$)
100{ 107{
101${args_declaration(args=func.setter_keys)}$${args_declaration(args=func.setter_values)}$${init(mcls=cls.init,mfunc=func.set_init)}$ 108${args_declaration(args=func.setter_keys)}$${args_declaration(args=func.setter_values)}$${init(mcls=cls.init,mfunc=func.set_init)}$
102${func.arg_set_init}$ 109${func.arg_set_init}$
103 ${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)-->); 110 ${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)-->);
104${func.arg_set_shutdown}$ 111${func.arg_set_shutdown}$
105${shutdown(mcls=cls.shutdown,mfunc=func.set_shutdown)}$ 112${shutdown(mcls=cls.shutdown,mfunc=func.set_shutdown)}$
106} 113}
@@ -116,10 +123,10 @@ void ${cls.myfullname}$_test(TCase *tc)
116 tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_method_name}$); 123 tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_method_name}$);
117 <!--(end)--> 124 <!--(end)-->
118 <!--(for func in cls.properties)--> 125 <!--(for func in cls.properties)-->
119 <!--(if func.getter_scope)--> 126 <!--(if func.getter_scope == func.getter_scope.PUBLIC)-->
120 tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_getter_name}$); 127 tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_getter_name}$);
121 <!--(end)--> 128 <!--(end)-->
122 <!--(if func.setter_scope)--> 129 <!--(if func.setter_scope == func.setter_scope.PUBLIC)-->
123 tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_setter_name}$); 130 tcase_add_test(tc, ${cls.myfullname}$_${func.full_c_setter_name}$);
124 <!--(end)--> 131 <!--(end)-->
125 <!--(end)--> 132 <!--(end)-->