Test rework #9: Efreet
authorVincent Torri <vincent dot torri at gmail dot com>
Thu, 4 Feb 2016 13:42:13 +0000 (14:42 +0100)
committerTom Hacohen <tom@stosb.com>
Tue, 16 Feb 2016 12:41:06 +0000 (12:41 +0000)
this efreet test suite needs more love later

18 files changed:
src/tests/efreet/ef_cache.c
src/tests/efreet/ef_data_dirs.c
src/tests/efreet/ef_desktop.c
src/tests/efreet/ef_icon_theme.c
src/tests/efreet/ef_ini.c
src/tests/efreet/ef_locale.c
src/tests/efreet/ef_menu.c
src/tests/efreet/ef_mime.c
src/tests/efreet/ef_test.h
src/tests/efreet/ef_utils.c
src/tests/efreet/efreet_async_test.c
src/tests/efreet/efreet_icon_cache_dump.c
src/tests/efreet/efreet_spec_test.c
src/tests/efreet/efreet_suite.c
src/tests/efreet/efreet_test_efreet.c
src/tests/efreet/efreet_test_efreet_cache.c
src/tests/efreet/efreet_user_dir.c
src/tests/efreet/main.c

index c83aa01..847c97b 100644 (file)
@@ -1,13 +1,12 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
 #include <stdio.h>
+
 #include <Ecore.h>
+#include <Efreet.h>
 
-#include "Efreet.h"
 #include "ef_test.h"
 
 #if 0
index 894e2e0..d79b742 100644 (file)
@@ -1,15 +1,13 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include "Efreet.h"
-
-#include <Ecore_File.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
+
+#include <Ecore_File.h>
+#include <Efreet.h>
 
 int
 ef_cb_efreet_data_home(void)
index 2ceed1b..c4fa675 100644 (file)
@@ -1,16 +1,15 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include "Efreet.h"
-#include "config.h"
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
 #include <unistd.h>
 #include <limits.h>
+
+#include <Efreet.h>
+
 #include "ef_test.h"
 
 typedef struct
index a0d1f1a..7b4cb5b 100644 (file)
@@ -1,16 +1,15 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include "Efreet.h"
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
 #include <limits.h>
+
 #include <Ecore.h>
 #include <Ecore_File.h>
+#include <Efreet.h>
 
 #define SIZE 128
 #define THEME "Tango"
index 9fb95ca..57457e0 100644 (file)
@@ -1,14 +1,13 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include "Efreet.h"
-#include "config.h"
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
+
+#include <Efreet.h>
+
 #include "ef_test.h"
 
 int
index 7ad47f2..3d52f6f 100644 (file)
@@ -1,16 +1,15 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include "Efreet.h"
-#define EFREET_MODULE_LOG_DOM /* no logging in this file */
-#include "efreet_private.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
+#include <Efreet.h>
+#define EFREET_MODULE_LOG_DOM /* no logging in this file */
+#include "efreet_private.h"
+
 int
 ef_cb_locale(void)
 {
index ba53bff..4917341 100644 (file)
@@ -1,13 +1,12 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include "Efreet.h"
-#include "config.h"
 #include <stdio.h>
 #include <unistd.h>
+
+#include <Efreet.h>
+
 #include "ef_test.h"
 
 #if 0
index 8940974..adbb2aa 100644 (file)
@@ -1,16 +1,15 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include "Efreet.h"
-#include "Efreet_Mime.h"
-#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
+
 #include <Ecore.h>
+#include <Efreet.h>
+#include <Efreet_Mime.h>
+
 #include "ef_test.h"
 
 #define THEME "Tango"
index 5d2b83a..4fdde4d 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef EF_TEST
 #define EF_TEST
 
-#include "config.h"
-
 #include <eina_types.h>
 
 #define IF_FREE(x) do { if (x) free(x); x = NULL; } while (0);
index 75f520d..7ecda39 100644 (file)
@@ -1,8 +1,11 @@
-#include "config.h" 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
-#include "Efreet.h"
 #include <stdio.h>
 
+#include <Efreet.h>
+
 int
 ef_cb_utils(void)
 {
index ce85e42..49acaa0 100644 (file)
@@ -1,6 +1,9 @@
-#include "config.h" 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
 #include <unistd.h>
+
 #include <Eina.h>
 #include <Ecore.h>
 #include <Efreet.h>
index 095f8fa..313c890 100644 (file)
@@ -1,10 +1,9 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
-#include <limits.h>
+
 #include <stdio.h>
+#include <limits.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <fcntl.h>
@@ -18,7 +17,7 @@
 
 #define EFREET_MODULE_LOG_DOM /* no logging in this file */
 
-#include "Efreet.h"
+#include <Efreet.h>
 #include "efreet_private.h"
 #include "efreet_cache_private.h"
 
index 92ce538..c209107 100644 (file)
@@ -1,12 +1,11 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <Efreet.h>
 #include <stdio.h>
 #include <limits.h>
+
+#include <Efreet.h>
 #include "ef_test.h"
 
 static void dump(Efreet_Menu *menu, const char *path);
index bbfd69c..732e101 100644 (file)
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <Efreet.h>
-
 #include "efreet_suite.h"
+#include "../efl_check.h"
 
-typedef struct _Efreet_Test_Case Efreet_Test_Case;
-
-struct _Efreet_Test_Case
-{
-   const char *test_case;
-   void      (*build)(TCase *tc);
-};
-
-static const Efreet_Test_Case etc[] = {
+static const Efl_Test_Case etc[] = {
   { "Efreet", efreet_test_efreet },
   { "Efreet Cache", efreet_test_efreet_cache },
   { NULL, NULL }
 };
 
-static void
-_list_tests(void)
-{
-  const Efreet_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 *
-efreet_suite_build(int argc, const char **argv)
-{
-   TCase *tc;
-   Suite *s;
-   int i;
-
-   s = suite_create("Efreet");
-
-   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;
 
-   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 = efreet_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_NORMAL);
-   failed_count = srunner_ntests_failed(sr);
-   srunner_free(sr);
+   failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
+                                           "Efreet", etc);
 
    return (failed_count == 0) ? 0 : 255;
 }
index a21a388..d35ec9e 100644 (file)
@@ -1,5 +1,3 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
index 1e15953..2f8972d 100644 (file)
@@ -1,5 +1,3 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
index 7a37fb0..1555efd 100644 (file)
@@ -1,5 +1,3 @@
-#include "config.h" 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
index 4bf2697..6c8a700 100644 (file)
@@ -1,15 +1,17 @@
-#include "config.h" 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 
-#include "Efreet.h"
+#include <Ecore.h>
+#include <Efreet.h>
+#include <Efreet_Mime.h>
 /* no logging */
 #define EFREET_MODULE_LOG_DOM
 #include "efreet_private.h"
-#include "Efreet_Mime.h"
-#include "config.h"
-#include <Ecore.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 int ef_cb_efreet_data_home(void);
 int ef_cb_efreet_config_home(void);