diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-07-06 10:48:27 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-07-06 11:16:17 +0100 |
commit | a877aefebd9148045865a9b5605197410893c671 (patch) | |
tree | b3b6703bba216ba1debbb1b1c58054e507c542a5 | |
parent | 7492f65618a4f3e8bd2d909a05efefe6e7c28887 (diff) |
checks: rewrite gsttagsetter test to use fewer g_usleep()
Something about that seems to interact badly with some schedulers,
so do things differently.
Fixes #623469.
-rw-r--r-- | tests/check/gst/gsttagsetter.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tests/check/gst/gsttagsetter.c b/tests/check/gst/gsttagsetter.c index 2b166944c7..5802823f13 100644 --- a/tests/check/gst/gsttagsetter.c +++ b/tests/check/gst/gsttagsetter.c @@ -226,26 +226,30 @@ GST_START_TEST (test_merge_modes_skip_empty) GST_END_TEST static int spin_and_wait = 1; static int threads_running = 0; -#define THREADS_CYCLES 1000 +#define THREADS_TEST_SECONDS 1.5 static gpointer test_threads_thread_func1 (gpointer data) { GstTagSetter *setter = GST_TAG_SETTER (data); - int i; + GTimer *timer; + + timer = g_timer_new (); g_atomic_int_inc (&threads_running); while (g_atomic_int_get (&spin_and_wait)) g_usleep (0); GST_INFO ("Go!"); + g_timer_start (timer); - for (i = 0; i < THREADS_CYCLES; ++i) { + while (g_timer_elapsed (timer, NULL) < THREADS_TEST_SECONDS) { gst_tag_setter_add_tags (setter, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "some artist", GST_TAG_TITLE, "some title", GST_TAG_TRACK_NUMBER, 6, NULL); } + g_timer_destroy (timer); GST_INFO ("Done"); return NULL; @@ -255,20 +259,24 @@ static gpointer test_threads_thread_func2 (gpointer data) { GstTagSetter *setter = GST_TAG_SETTER (data); - int i; + GTimer *timer; + + timer = g_timer_new (); g_atomic_int_inc (&threads_running); while (g_atomic_int_get (&spin_and_wait)) g_usleep (0); GST_INFO ("Go!"); + g_timer_start (timer); - for (i = 0; i < THREADS_CYCLES; ++i) { + while (g_timer_elapsed (timer, NULL) < THREADS_TEST_SECONDS) { gst_tag_setter_add_tags (setter, GST_TAG_MERGE_PREPEND, GST_TAG_CODEC, "MP42", GST_TAG_COMMENT, "deep insights go here", GST_TAG_TRACK_COUNT, 10, NULL); } + g_timer_destroy (timer); GST_INFO ("Done"); return NULL; @@ -278,19 +286,22 @@ static gpointer test_threads_thread_func3 (gpointer data) { GstTagSetter *setter = GST_TAG_SETTER (data); - int i; + GTimer *timer; + + timer = g_timer_new (); g_atomic_int_inc (&threads_running); while (g_atomic_int_get (&spin_and_wait)) g_usleep (0); GST_INFO ("Go!"); + g_timer_start (timer); - for (i = 0; i < THREADS_CYCLES; ++i) { + while (g_timer_elapsed (timer, NULL) < THREADS_TEST_SECONDS) { gst_tag_setter_reset_tags (setter); - g_usleep (10); } + g_timer_destroy (timer); GST_INFO ("Done"); return NULL; |