From 73278948a3469c4065d6b79478de6ac26cbd6b32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 4 Apr 2015 01:23:48 +0100 Subject: [PATCH] tests: basetime: fix timeouts when running under valgrind This test sets a rather short timeout, increase this when we run under valgrind. Also add a short sleep to the fakesrc ! fakesink pipeline to avoid thrashing the CPU, which would often not stop the main loop when it should. Also fix wrong (0.10) return value from pad probe callback. --- tests/check/pipelines/basetime.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/check/pipelines/basetime.c b/tests/check/pipelines/basetime.c index 180935f..1664188 100644 --- a/tests/check/pipelines/basetime.c +++ b/tests/check/pipelines/basetime.c @@ -24,6 +24,10 @@ #include "config.h" #endif +#ifdef HAVE_VALGRIND +#include +#endif + #include #ifndef GST_DISABLE_PARSE @@ -55,7 +59,7 @@ buffer_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) } old_ts = new_ts; - return TRUE; + return GST_PAD_PROBE_OK; } GST_START_TEST (test_basetime_calculation) @@ -68,7 +72,7 @@ GST_START_TEST (test_basetime_calculation) loop = g_main_loop_new (NULL, FALSE); /* The "main" pipeline */ - p1 = gst_parse_launch ("fakesrc ! fakesink", NULL); + p1 = gst_parse_launch ("fakesrc ! identity sleep-time=1 ! fakesink", NULL); fail_if (p1 == NULL); /* Create a sub-bin that is activated only in "certain situations" */ @@ -130,9 +134,19 @@ baseaudiosrc_suite (void) { Suite *s = suite_create ("baseaudiosrc"); TCase *tc_chain = tcase_create ("general"); + guint timeout; /* timeout 6 sec */ - tcase_set_timeout (tc_chain, 6); + timeout = 6; + +#ifdef HAVE_VALGRIND + { + if (RUNNING_ON_VALGRIND) + timeout *= 4; + } +#endif + + tcase_set_timeout (tc_chain, timeout); suite_add_tcase (s, tc_chain); #ifndef GST_DISABLE_PARSE -- 2.7.4