From 9dcad9fd9ea0636ecad32ef44b03cd5c10c1d587 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 4 Feb 2016 14:57:14 +0100 Subject: [PATCH] Test rework #15: Elua --- src/tests/elua/elua_lib.c | 5 ++- src/tests/elua/elua_suite.c | 95 ++++----------------------------------------- src/tests/elua/elua_suite.h | 1 - 3 files changed, 11 insertions(+), 90 deletions(-) diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c index ef043ba..c6a5b63 100644 --- a/src/tests/elua/elua_lib.c +++ b/src/tests/elua/elua_lib.c @@ -5,8 +5,9 @@ #include #include -#include -#include "Elua.h" +#include +#include + #include "elua_suite.h" START_TEST(elua_api) diff --git a/src/tests/elua/elua_suite.c b/src/tests/elua/elua_suite.c index 13a6df8..1bf0ec8 100644 --- a/src/tests/elua/elua_suite.c +++ b/src/tests/elua/elua_suite.c @@ -2,107 +2,28 @@ # include #endif -#include -#include - -#include #include "elua_suite.h" +#include "../efl_check.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[] = { +static const Efl_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; + int 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; - } + if (!_efl_test_option_disp(argc, argv, etc)) + 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); + failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, + "Elua", etc); return (failed_count == 0) ? 0 : 255; } diff --git a/src/tests/elua/elua_suite.h b/src/tests/elua/elua_suite.h index 0d48d02..7485f53 100644 --- a/src/tests/elua/elua_suite.h +++ b/src/tests/elua/elua_suite.h @@ -6,4 +6,3 @@ void elua_lib_test(TCase *tc); #endif /* _ELUA_SUITE_H */ - -- 2.7.4