summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-10-18 15:41:50 +0100
committerTom Hacohen <tom@stosb.com>2013-10-18 15:41:50 +0100
commit0b7eee52434a0194829b9135f053191413805ba6 (patch)
tree2e39a16e8bc6243f0ace3e0babe916108b0a6ece
parentd17e0d39369b0c6a9dfb596688a38615dd25922d (diff)
downloadefl-devs/tasn/stefan.tar.gz
Stefan: Revert "eina: let's add some straight forward test."devs/tasn/stefan
This reverts commit 577ae1debc724cb0144d903a8a1bfa4daf467475.
-rw-r--r--src/Makefile_Eina.am3
-rw-r--r--src/tests/eina/eina_suite.c1
-rw-r--r--src/tests/eina/eina_suite.h1
-rw-r--r--src/tests/eina/eina_test_lock.c172
4 files changed, 1 insertions, 176 deletions
diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am
index 5ad1c2096d..09264ced9d 100644
--- a/src/Makefile_Eina.am
+++ b/src/Makefile_Eina.am
@@ -268,8 +268,7 @@ tests/eina/eina_test_simple_xml_parser.c \
tests/eina/eina_test_value.c \
tests/eina/eina_test_cow.c \
tests/eina/eina_test_barrier.c \
-tests/eina/eina_test_tmpstr.c \
-tests/eina/eina_test_lock.c
+tests/eina/eina_test_tmpstr.c
# tests/eina/eina_test_model.c
tests_eina_eina_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
diff --git a/src/tests/eina/eina_suite.c b/src/tests/eina/eina_suite.c
index 1a27503cf3..1577b3aebb 100644
--- a/src/tests/eina/eina_suite.c
+++ b/src/tests/eina/eina_suite.c
@@ -73,7 +73,6 @@ static const Eina_Test_Case etc[] = {
// { "Model", eina_test_model },
{ "Barrier", eina_test_barrier },
{ "Tmp String", eina_test_tmpstr },
- { "Locking", eina_test_locking },
{ NULL, NULL }
};
diff --git a/src/tests/eina/eina_suite.h b/src/tests/eina/eina_suite.h
index e786309e0c..85a32cf556 100644
--- a/src/tests/eina/eina_suite.h
+++ b/src/tests/eina/eina_suite.h
@@ -60,6 +60,5 @@ void eina_test_model(TCase *tc);
void eina_test_cow(TCase *tc);
void eina_test_barrier(TCase *tc);
void eina_test_tmpstr(TCase *tc);
-void eina_test_locking(TCase *tc);
#endif /* EINA_SUITE_H_ */
diff --git a/src/tests/eina/eina_test_lock.c b/src/tests/eina/eina_test_lock.c
deleted file mode 100644
index a813352d2a..0000000000
--- a/src/tests/eina/eina_test_lock.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* EINA - EFL data type library
- * Copyright (C) 2013 Cedric Bail
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library;
- * if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "eina_suite.h"
-#include "Eina.h"
-
-static Eina_Spinlock spin;
-static Eina_Thread thread;
-static unsigned int counter;
-
-static void *
-_eina_test_lock_thread(void *data, Eina_Thread t)
-{
- unsigned int i;
-
- fail_if(!eina_thread_equal(t, thread));
- fail_if(strcmp("test", data));
-
- for (i = 0; i < 10000; i++)
- {
- fail_if(eina_spinlock_take(&spin) != EINA_LOCK_SUCCEED);
- counter++;
- fail_if(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
- }
-
- return data;
-}
-
-START_TEST(eina_test_spinlock)
-{
- unsigned int i;
-
- fail_if(!eina_init());
-
- counter = 0;
- fail_if(!eina_spinlock_new(&spin));
-
- fail_if(!eina_thread_create(&thread, EINA_THREAD_NORMAL, 0, _eina_test_lock_thread, "test"));
-
- for (i = 0; i < 10000; i++)
- {
- fail_if(eina_spinlock_take(&spin) != EINA_LOCK_SUCCEED);
- counter++;
- fail_if(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
- }
-
- fail_if(strcmp("test", eina_thread_join(thread)));
-
- fail_if(counter != 20000);
-
- eina_spinlock_free(&spin);
-
- eina_shutdown();
-}
-END_TEST
-
-static Eina_TLS key;
-
-static void *
-_eina_test_tls_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
-{
- unsigned int mystack = 21;
-
- fail_if(!eina_tls_set(key, &mystack));
- fail_if(eina_tls_get(key) != &mystack);
-
- return NULL;
-}
-
-START_TEST(eina_test_tls)
-{
- unsigned int ft = 42;
-
- fail_if(!eina_init());
-
- fail_if(!eina_tls_new(&key));
-
- fail_if(!eina_tls_set(key, &ft));
-
- fail_if(!eina_thread_create(&thread, EINA_THREAD_NORMAL, 0, _eina_test_tls_thread, NULL));
-
- eina_thread_join(thread);
-
- fail_if(eina_tls_get(key) != &ft);
-
- eina_tls_free(key);
-
- eina_shutdown();
-}
-END_TEST
-
-static Eina_Lock mtcond;
-static Eina_Condition cond;
-static Eina_RWLock mutex;
-
-static void *
-_eina_test_rwlock_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
-{
- fail_if(!eina_condition_broadcast(&cond));
-
- fail_if(eina_rwlock_take_write(&mutex) != EINA_LOCK_SUCCEED);
- counter = 7200;
- fail_if(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
-
- fail_if(!eina_condition_broadcast(&cond));
-
- return NULL;
-}
-
-START_TEST(eina_test_rwlock)
-{
- fail_if(!eina_init());
-
- fail_if(!eina_rwlock_new(&mutex));
- fail_if(!eina_lock_new(&mtcond));
- fail_if(!eina_condition_new(&cond, &mtcond));
-
- counter = 42;
-
- fail_if(eina_rwlock_take_read(&mutex) != EINA_LOCK_SUCCEED);
- fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
-
- fail_if(!eina_thread_create(&thread, EINA_THREAD_NORMAL, 0, _eina_test_rwlock_thread, NULL));
-
- fail_if(!eina_condition_wait(&cond));
- fail_if(!eina_lock_release(&mtcond));
-
- fail_if(counter != 42);
- fail_if(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
-
- fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
- fail_if(!eina_condition_wait(&cond));
- fail_if(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
-
- fail_if(eina_rwlock_take_read(&mutex) != EINA_LOCK_SUCCEED);
- fail_if(counter != 7200);
- fail_if(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
-
- eina_condition_free(&cond);
- eina_lock_free(&mtcond);
- eina_rwlock_free(&mutex);
-
- eina_shutdown();
-}
-END_TEST
-
-void
-eina_test_locking(TCase *tc)
-{
- tcase_add_test(tc, eina_test_spinlock);
- tcase_add_test(tc, eina_test_tls);
- tcase_add_test(tc, eina_test_rwlock);
-}