summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-16 10:55:27 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:20 +0100
commitdbe34d803c37a1e9b85b787fba4f6e015c66c134 (patch)
treed6adf49a97fa213fd2777f6b500664fbaedb6ea8
parent7f05cfc0e6795f4dee66c0b9175c658f40d14ab4 (diff)
downloadefl-dbe34d803c37a1e9b85b787fba4f6e015c66c134.tar.gz
elua lib: add test suite
-rw-r--r--src/Makefile_Elua.am29
-rw-r--r--src/tests/elua/elua_lib.c21
-rw-r--r--src/tests/elua/elua_suite.c108
-rw-r--r--src/tests/elua/elua_suite.h9
4 files changed, 167 insertions, 0 deletions
diff --git a/src/Makefile_Elua.am b/src/Makefile_Elua.am
index 49ba426711..fa2f078428 100644
--- a/src/Makefile_Elua.am
+++ b/src/Makefile_Elua.am
@@ -102,4 +102,33 @@ eluacore_DATA = \
EXTRA_DIST += $(eluacore_DATA)
+if EFL_ENABLE_TESTS
+
+check_PROGRAMS += tests/elua/elua_suite
+
+tests_elua_elua_suite_SOURCES = \
+tests/elua/elua_lib.c \
+tests/elua/elua_suite.c \
+tests/elua/elua_suite.h
+
+tests_elua_elua_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
+-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/elua\" \
+-DPACKAGE_DATA_DIR=\"$(top_srcdir)/src/tests/elua\" \
+-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
+@CHECK_CFLAGS@ \
+@ELUA_CFLAGS@
+
+TESTS += tests/elua/elua_suite
+
+if HAVE_OSX
+if HAVE_X86_64
+tests_elua_elua_suite_LDFLAGS = -pagezero_size 10000 -image_base 100000000
+endif
+endif
+
+tests_elua_elua_suite_LDADD = @CHECK_LIBS@ @USE_ELUA_LIBS@
+tests_elua_elua_suite_DEPENDENCIES = @USE_ELUA_INTERNAL_LIBS@
+
+endif
+
endif
diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c
new file mode 100644
index 0000000000..702aed50fe
--- /dev/null
+++ b/src/tests/elua/elua_lib.c
@@ -0,0 +1,21 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include<Eina.h>
+#include "Elua.h"
+#include "elua_suite.h"
+
+/*START_TEST(test_name)
+{
+}
+END_TEST*/
+
+void elua_lib_test(TCase *tc)
+{
+ //tcase_add_test(tc, test_name);
+}
+
diff --git a/src/tests/elua/elua_suite.c b/src/tests/elua/elua_suite.c
new file mode 100644
index 0000000000..13a6df8f85
--- /dev/null
+++ b/src/tests/elua/elua_suite.c
@@ -0,0 +1,108 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include<Eina.h>
+#include "elua_suite.h"
+
+typedef struct _Elua_Test_Case Elua_Test_Case;
+
+struct _Elua_Test_Case
+{
+ const char *test_case;
+ void (*build)(TCase *tc);
+};
+
+static const Elua_Test_Case etc[] = {
+ { "Elua Library", elua_lib_test},
+ { NULL, NULL }
+};
+
+static void
+_list_tests(void)
+{
+ const Elua_Test_Case *itr;
+
+ itr = etc;
+ fputs("Available Test Cases:\n", stderr);
+ for (; itr->test_case; itr++)
+ fprintf(stderr, "\t%s\n", itr->test_case);
+}
+
+static Eina_Bool
+_use_test(int argc, const char **argv, const char *test_case)
+{
+ if (argc < 1)
+ return 1;
+
+ for (; argc > 0; argc--, argv++)
+ if (strcmp(test_case, *argv) == 0)
+ return 1;
+ return 0;
+}
+
+static Suite *
+elua_suite_build(int argc, const char **argv)
+{
+ TCase *tc;
+ Suite *s;
+ int i;
+
+ s = suite_create("Elua");
+
+ for (i = 0; etc[i].test_case; ++i)
+ {
+ if (!_use_test(argc, argv, etc[i].test_case)) continue;
+ tc = tcase_create(etc[i].test_case);
+
+ etc[i].build(tc);
+
+ suite_add_tcase(s, tc);
+#ifndef _WIN32
+ tcase_set_timeout(tc, 0);
+#endif
+ }
+
+ return s;
+}
+
+int
+main(int argc, char **argv)
+{
+ Suite *s;
+ SRunner *sr;
+ int i, failed_count;
+ setenv("CK_FORK", "no", 0);
+
+ for (i = 1; i < argc; i++)
+ if ((strcmp(argv[i], "-h" ) == 0) ||
+ (strcmp(argv[i], "--help") == 0))
+ {
+ fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
+ argv[0]);
+ _list_tests();
+ return 0;
+ }
+ else if ((strcmp(argv[i], "-l" ) == 0) ||
+ (strcmp(argv[i], "--list") == 0))
+ {
+ _list_tests();
+ return 0;
+ }
+
+ putenv("EFL_RUN_IN_TREE=1");
+
+ s = elua_suite_build(argc - 1, (const char **)argv + 1);
+ sr = srunner_create(s);
+
+ srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
+
+ srunner_run_all(sr, CK_ENV);
+ failed_count = srunner_ntests_failed(sr);
+ srunner_free(sr);
+
+ return (failed_count == 0) ? 0 : 255;
+}
diff --git a/src/tests/elua/elua_suite.h b/src/tests/elua/elua_suite.h
new file mode 100644
index 0000000000..0d48d02617
--- /dev/null
+++ b/src/tests/elua/elua_suite.h
@@ -0,0 +1,9 @@
+#ifndef _ELUA_SUITE_H
+#define _ELUA_SUITE_H
+
+#include <check.h>
+
+void elua_lib_test(TCase *tc);
+
+#endif /* _ELUA_SUITE_H */
+