#include <fcntl.h>
#include <unistd.h>
-#ifdef EFL_HAVE_POSIX_THREADS
+#include <Eina.h>
+
+#ifdef EINA_HAVE_THREADS
+#if ((!defined(_WIN32_WCE)) && (!defined(_WIN32)))
# include <pthread.h>
-#endif /* ifdef EFL_HAVE_POSIX_THREADS */
+# define _EET_INCLUDED_PTHREAD
+#endif
+#endif /* ifdef EINA_HAVE_THREADS */
#include <check.h>
-#include <Eina.h>
-
#include "eet_suite.h"
START_TEST(eet_test_init)
fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0));
+ result = eet_data_read(ef, edd, EET_TEST_FILE_KEY1);
+ fail_if(!result);
+
+ /* Test the resulting data. */
+ fail_if(_eet_test_ex_check(result, 0) != 0);
+
eet_close(ef);
/* Read back the data. */
unsigned int w;
unsigned int h;
+ eet_init();
+
fail_if(!(file = tmpnam(file)));
/* Save the encoded data in a file. */
END_TEST
-#ifdef EFL_HAVE_THREADS
+#ifdef EINA_HAVE_THREADS
static Eina_Bool open_worker_stop;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
static void *
open_close_worker(void * path)
pthread_exit(NULL);
} /* open_close_worker */
-# else /* ifdef EFL_HAVE_POSIX_THREADS */
+# else /* ifdef _EET_INCLUDED_PTHREAD */
static unsigned int __stdcall
open_close_worker(void * path)
_endthreadex(0);
} /* open_close_worker */
-# endif /* ifdef EFL_HAVE_POSIX_THREADS */
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
START_TEST(eet_cache_concurrency)
{
Eet_File * ef;
void * thread_ret;
unsigned int n;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
pthread_t thread;
-# else /* ifdef EFL_HAVE_POSIX_THREADS */
+# else /* ifdef _EET_INCLUDED_PTHREAD */
uintptr_t thread;
unsigned int thread_id;
DWORD ret;
-# endif /* ifdef EFL_HAVE_POSIX_THREADS */
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
eet_init();
+ eina_threads_init();
/* create a file to test with */
fail_if(!(file = tmpnam(file)));
/* start a thread that repeatedly opens and closes a file */
open_worker_stop = 0;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
pthread_create(&thread, NULL, open_close_worker, file);
-# else /* ifdef EFL_HAVE_POSIX_THREADS */
+# else /* ifdef _EET_INCLUDED_PTHREAD */
thread = _beginthreadex(NULL, 0, open_close_worker, file, 0, &thread_id);
-# endif /* ifdef EFL_HAVE_POSIX_THREADS */
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
/* clear the cache repeatedly in this thread */
for (n = 0; n < 50000; ++n)
{
/* join the other thread, and fail if it returned an error message */
open_worker_stop = 1;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
fail_if(pthread_join(thread, &thread_ret) != 0);
fail_unless(thread_ret == NULL, (char const *)thread_ret);
-# else /* ifdef EFL_HAVE_POSIX_THREADS */
+# else /* ifdef _EET_INCLUDED_PTHREAD */
ret = WaitForSingleObject((HANDLE)thread, INFINITE);
fail_if(ret != WAIT_OBJECT_0);
fail_if(GetExitCodeThread((HANDLE)thread, &ret) == FALSE);
fail_if(ret != 0);
-# endif /* ifdef EFL_HAVE_POSIX_THREADS */
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
fail_if(unlink(file) != 0);
+
+ eina_threads_shutdown();
eet_shutdown();
}
END_TEST
-#endif /* EFL_HAVE_THREADS */
+#endif /* EINA_HAVE_THREADS */
typedef struct _Eet_Connection_Data Eet_Connection_Data;
struct _Eet_Connection_Data
suite_add_tcase(s, tc);
#endif /* ifdef HAVE_CIPHER */
-#ifdef EFL_HAVE_THREADS
+#ifdef EINA_HAVE_THREADS
tc = tcase_create("Eet Cache");
tcase_add_test(tc, eet_cache_concurrency);
suite_add_tcase(s, tc);
s = eet_suite();
sr = srunner_create(s);
- srunner_run_all(sr, CK_NORMAL);
+ srunner_run_all(sr, CK_ENV);
failed_count = srunner_ntests_failed(sr);
srunner_free(sr);