summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-10-04 18:52:55 -0400
committerRyan Lortie <desrt@desrt.ca>2011-10-04 18:52:55 -0400
commit9793708931640df4d89f87d16678508d417fd1e6 (patch)
tree302323f8b17fc39c6c853ef0c07ad6bc65fa3efd
parent4d5fe2704834e5038aa7a05a54445336cff831b6 (diff)
drop errorcheck mutex test
We don't support errorchecking mutexes in GLib anymore.
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/errorcheck-mutex-test.c131
3 files changed, 0 insertions, 133 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index f638a8af8..d3fec2e73 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -16,7 +16,6 @@ datetime
deftype
dirname-test
env-test
-errorcheck-mutex-test
file-test
file-test-get-contents
gio-test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9938c8d59..59d02a7f0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,7 +62,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \
unicode-normalize \
unicode-collate \
$(timeloop) \
- errorcheck-mutex-test \
assert-msg-test \
datetime
diff --git a/tests/errorcheck-mutex-test.c b/tests/errorcheck-mutex-test.c
deleted file mode 100644
index 5b300572c..000000000
--- a/tests/errorcheck-mutex-test.c
+++ /dev/null
@@ -1,131 +0,0 @@
-#undef G_DISABLE_ASSERT
-#undef G_LOG_DOMAIN
-#define G_ERRORCHECK_MUTEXES
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-
-static gpointer
-locking_thread (gpointer mutex)
-{
- g_mutex_lock ((GMutex*)mutex);
-
- return NULL;
-}
-
-static void
-lock_locked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- g_mutex_lock (mutex);
- g_mutex_lock (mutex);
-}
-
-static void
-trylock_locked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- g_mutex_lock (mutex);
- g_mutex_trylock (mutex);
-}
-
-static void
-unlock_unlocked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- g_mutex_lock (mutex);
- g_mutex_unlock (mutex);
- g_mutex_unlock (mutex);
-}
-
-static void
-free_locked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- g_mutex_lock (mutex);
- g_mutex_free (mutex);
-}
-
-static void
-wait_on_unlocked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- GCond* cond = g_cond_new ();
- g_cond_wait (cond, mutex);
-}
-
-static void
-wait_on_otherwise_locked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- GCond* cond = g_cond_new ();
- GThread* thread = g_thread_create (locking_thread, mutex, TRUE, NULL);
- g_assert (thread != NULL);
- g_usleep (G_USEC_PER_SEC);
- g_cond_wait (cond, mutex);
-}
-
-static void
-timed_wait_on_unlocked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- GCond* cond = g_cond_new ();
- g_cond_timed_wait (cond, mutex, NULL);
-}
-
-static void
-timed_wait_on_otherwise_locked_mutex (void)
-{
- GMutex* mutex = g_mutex_new ();
- GCond* cond = g_cond_new ();
- GThread* thread = g_thread_create (locking_thread, mutex, TRUE, NULL);
- g_assert (thread != NULL);
- g_usleep (G_USEC_PER_SEC);
- g_cond_timed_wait (cond, mutex, NULL);
-}
-
-struct
-{
- char *name;
- void (*func)();
-} func_table[] =
-{
- {"lock_locked_mutex", lock_locked_mutex},
- {"trylock_locked_mutex", trylock_locked_mutex},
- {"unlock_unlocked_mutex", unlock_unlocked_mutex},
- {"free_locked_mutex", free_locked_mutex},
- {"wait_on_unlocked_mutex", wait_on_unlocked_mutex},
- {"wait_on_otherwise_locked_mutex", wait_on_otherwise_locked_mutex},
- {"timed_wait_on_unlocked_mutex", timed_wait_on_unlocked_mutex},
- {"timed_wait_on_otherwise_locked_mutex",
- timed_wait_on_otherwise_locked_mutex}
-};
-
-int
-main (int argc, char* argv[])
-{
- int i;
-
- if (argc == 2)
- {
- for (i = 0; i < G_N_ELEMENTS (func_table); i++)
- {
- if (strcmp (func_table[i].name, argv[1]) == 0)
- {
- g_thread_init (NULL);
- func_table[i].func ();
- g_assert_not_reached ();
- }
- }
- }
-
- fprintf (stderr, "Usage: errorcheck-mutex-test [TEST]\n\n");
- fprintf (stderr, " where TEST can be one of:\n\n");
- for (i = 0; i < G_N_ELEMENTS (func_table); i++)
- {
- fprintf (stderr, " %s\n", func_table[i].name);
- }
-
- return 0;
-}