From: Jan Schmidt Date: Thu, 18 Aug 2005 16:00:34 +0000 (+0000) Subject: check/gst/gstevents.c: Provide more error margin in clock measurements to allow for... X-Git-Tag: RELEASE-0_9_2~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b344834e87fdb673483bd69fce52845d5b933723;p=platform%2Fupstream%2Fgstreamer.git check/gst/gstevents.c: Provide more error margin in clock measurements to allow for g_get_current_time inaccuracies. Original commit message from CVS: * check/gst/gstevents.c: (GST_START_TEST), (event_probe), (test_event), (timediff), (gstevents_suite): Provide more error margin in clock measurements to allow for g_get_current_time inaccuracies. --- diff --git a/ChangeLog b/ChangeLog index 98b2b9d..639b8db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ * check/gst/gstevents.c: (GST_START_TEST), (event_probe), (test_event), (timediff), (gstevents_suite): + Provide more error margin in clock measurements to allow for + g_get_current_time inaccuracies. + +2005-08-18 Jan Schmidt + + * check/gst/gstevents.c: (GST_START_TEST), (event_probe), + (test_event), (timediff), (gstevents_suite): Fix error message output so I might be able to tell why the test works here but fails on the build farm. diff --git a/check/gst/gstevents.c b/check/gst/gstevents.c index 4356c26..c58bebf 100644 --- a/check/gst/gstevents.c +++ b/check/gst/gstevents.c @@ -243,16 +243,16 @@ static void test_event /* Wait up to 5 seconds for the event to appear */ if (expect_before_q) { - for (i = 0; i < 50; i++) { - g_usleep (G_USEC_PER_SEC / 10); + for (i = 0; i < 500; i++) { + g_usleep (G_USEC_PER_SEC / 100); if (got_event_before_q != NULL) break; } fail_if (got_event_before_q == NULL); fail_unless (GST_EVENT_TYPE (got_event_before_q) == type); } else { - for (i = 0; i < 50; i++) { - g_usleep (G_USEC_PER_SEC / 10); + for (i = 0; i < 500; i++) { + g_usleep (G_USEC_PER_SEC / 100); if (got_event_after_q != NULL) break; } @@ -284,11 +284,11 @@ GST_START_TEST (send_custom_events) gst_bin_add_many (pipeline, fakesrc, queue, fakesink, NULL); fail_unless (gst_element_link_many (fakesrc, queue, fakesink, NULL)); - /* Send 25 buffers per sec */ - g_object_set (G_OBJECT (fakesrc), "silent", TRUE, "datarate", 25, + /* Send 100 buffers per sec */ + g_object_set (G_OBJECT (fakesrc), "silent", TRUE, "datarate", 100, "sizemax", 1, "sizetype", 2, NULL); g_object_set (G_OBJECT (queue), "max-size-buffers", 0, "max-size-time", - (guint64) 1.1 * GST_SECOND, "max-size-bytes", 0, NULL); + (guint64) GST_SECOND, "max-size-bytes", 0, NULL); g_object_set (G_OBJECT (fakesink), "silent", TRUE, "sync", TRUE, NULL); fail_if ((srcpad = gst_element_get_pad (fakesrc, "src")) == NULL); @@ -303,35 +303,42 @@ GST_START_TEST (send_custom_events) /* Upstream events */ test_event (GST_EVENT_CUSTOM_UP, sinkpad, TRUE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_UP took to long to reach source"); test_event (GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH took to long to reach source"); test_event (GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source"); /* Out of band downstream events */ test_event (GST_EVENT_CUSTOM_DS_OOB, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_DS_OOB took to long to reach source"); test_event (GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source"); /* In-band downstream events are expected to take at least 1 second * to traverse the the queue */ test_event (GST_EVENT_CUSTOM_DS, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) >= G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) >= G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %lld us", timediff (&got_event_time, &sent_event_time)); test_event (GST_EVENT_CUSTOM_BOTH, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) >= G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) >= G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %lld us", timediff (&got_event_time, &sent_event_time)); diff --git a/tests/check/gst/gstevents.c b/tests/check/gst/gstevents.c index 4356c26..c58bebf 100644 --- a/tests/check/gst/gstevents.c +++ b/tests/check/gst/gstevents.c @@ -243,16 +243,16 @@ static void test_event /* Wait up to 5 seconds for the event to appear */ if (expect_before_q) { - for (i = 0; i < 50; i++) { - g_usleep (G_USEC_PER_SEC / 10); + for (i = 0; i < 500; i++) { + g_usleep (G_USEC_PER_SEC / 100); if (got_event_before_q != NULL) break; } fail_if (got_event_before_q == NULL); fail_unless (GST_EVENT_TYPE (got_event_before_q) == type); } else { - for (i = 0; i < 50; i++) { - g_usleep (G_USEC_PER_SEC / 10); + for (i = 0; i < 500; i++) { + g_usleep (G_USEC_PER_SEC / 100); if (got_event_after_q != NULL) break; } @@ -284,11 +284,11 @@ GST_START_TEST (send_custom_events) gst_bin_add_many (pipeline, fakesrc, queue, fakesink, NULL); fail_unless (gst_element_link_many (fakesrc, queue, fakesink, NULL)); - /* Send 25 buffers per sec */ - g_object_set (G_OBJECT (fakesrc), "silent", TRUE, "datarate", 25, + /* Send 100 buffers per sec */ + g_object_set (G_OBJECT (fakesrc), "silent", TRUE, "datarate", 100, "sizemax", 1, "sizetype", 2, NULL); g_object_set (G_OBJECT (queue), "max-size-buffers", 0, "max-size-time", - (guint64) 1.1 * GST_SECOND, "max-size-bytes", 0, NULL); + (guint64) GST_SECOND, "max-size-bytes", 0, NULL); g_object_set (G_OBJECT (fakesink), "silent", TRUE, "sync", TRUE, NULL); fail_if ((srcpad = gst_element_get_pad (fakesrc, "src")) == NULL); @@ -303,35 +303,42 @@ GST_START_TEST (send_custom_events) /* Upstream events */ test_event (GST_EVENT_CUSTOM_UP, sinkpad, TRUE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_UP took to long to reach source"); test_event (GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH took to long to reach source"); test_event (GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source"); /* Out of band downstream events */ test_event (GST_EVENT_CUSTOM_DS_OOB, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_DS_OOB took to long to reach source"); test_event (GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) < G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source"); /* In-band downstream events are expected to take at least 1 second * to traverse the the queue */ test_event (GST_EVENT_CUSTOM_DS, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) >= G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) >= G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %lld us", timediff (&got_event_time, &sent_event_time)); test_event (GST_EVENT_CUSTOM_BOTH, srcpad, FALSE); - fail_unless (timediff (&got_event_time, &sent_event_time) >= G_USEC_PER_SEC, + fail_unless (timediff (&got_event_time, + &sent_event_time) >= G_USEC_PER_SEC / 2, "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %lld us", timediff (&got_event_time, &sent_event_time));