summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--src/tests/efreet/main.c40
2 files changed, 4 insertions, 37 deletions
diff --git a/configure.ac b/configure.ac
index 64196cb..f5d9631 100644
--- a/configure.ac
+++ b/configure.ac
@@ -536,7 +536,6 @@ AC_SUBST([SSE3_CFLAGS])
536AC_CHECK_FUNCS([\ 536AC_CHECK_FUNCS([\
537backtrace \ 537backtrace \
538backtrace_symbols \ 538backtrace_symbols \
539clearenv \
540execvp \ 539execvp \
541fpathconf \ 540fpathconf \
542fstatat \ 541fstatat \
diff --git a/src/tests/efreet/main.c b/src/tests/efreet/main.c
index 0833744..8ba4f0a 100644
--- a/src/tests/efreet/main.c
+++ b/src/tests/efreet/main.c
@@ -72,11 +72,10 @@ static Efreet_Test tests[] = {
72#endif 72#endif
73 {"Utils", ef_cb_utils}, 73 {"Utils", ef_cb_utils},
74 {"Mime", ef_mime_cb_get}, 74 {"Mime", ef_mime_cb_get},
75 {NULL, NULL} 75 { }
76}; 76};
77 77
78extern char **environ; 78extern char **environ;
79static Eina_List *environment = NULL;
80 79
81const char *ef_test_path_get(const char *component) 80const char *ef_test_path_get(const char *component)
82{ 81{
@@ -104,39 +103,12 @@ const char *ef_test_path_get(const char *component)
104 return buf; 103 return buf;
105} 104}
106 105
107void
108environment_store(void)
109{
110 char *env;
111 char **e;
112#ifdef HAVE_CLEARENV
113 EINA_LIST_FREE(environment, env)
114 free(env);
115 for (e = environ; *e; e++)
116 environment = eina_list_append(environment, strdup(*e));
117#endif
118}
119
120void
121environment_restore(void)
122{
123 Eina_List *l;
124 char *e;
125 if (!environment) return;
126#ifdef HAVE_CLEARENV
127 clearenv();
128 EINA_LIST_FOREACH(environment, l, e)
129 putenv(e);
130#endif
131}
132
133int 106int
134main(int argc, char ** argv) 107main(int argc, char ** argv)
135{ 108{
136 int i, passed = 0, num_tests = 0; 109 int i, passed = 0, num_tests = 0;
137 Eina_List *run = NULL; 110 Eina_List *run = NULL;
138 double total; 111 double total;
139 char *env;
140 112
141 eina_init(); 113 eina_init();
142 ecore_init(); 114 ecore_init();
@@ -160,7 +132,6 @@ main(int argc, char ** argv)
160 } 132 }
161 133
162 efreet_cache_update = 0; 134 efreet_cache_update = 0;
163 environment_store();
164 for (i = 0; tests[i].name; i++) 135 for (i = 0; tests[i].name; i++)
165 { 136 {
166 int ret; 137 int ret;
@@ -182,21 +153,18 @@ main(int argc, char ** argv)
182 printf("%s:\t\t", tests[i].name); 153 printf("%s:\t\t", tests[i].name);
183 fflush(stdout); 154 fflush(stdout);
184 start = ecore_time_get(); 155 start = ecore_time_get();
156
157 environ = NULL;
185 ret = tests[i].cb(); 158 ret = tests[i].cb();
159
186 printf("%s in %.3f seconds\n", (ret ? "PASSED" : "FAILED"), 160 printf("%s in %.3f seconds\n", (ret ? "PASSED" : "FAILED"),
187 ecore_time_get() - start); 161 ecore_time_get() - start);
188 passed += ret; 162 passed += ret;
189 163
190 efreet_shutdown(); 164 efreet_shutdown();
191 environment_restore();
192 } 165 }
193 166
194 printf("\n-----------------\n"); 167 printf("\n-----------------\n");
195#ifdef HAVE_CLEARENV
196 clearenv();
197 EINA_LIST_FREE(environment, env)
198 free(env);
199#endif
200 printf("Passed %d of %d tests.\n", passed, num_tests); 168 printf("Passed %d of %d tests.\n", passed, num_tests);
201 169
202 while (run) 170 while (run)