From: Thibault Saunier Date: Sun, 26 Sep 2021 02:51:52 +0000 (-0300) Subject: tests: aggregator: Take `TIMEOUT_FACTOR` env var into account X-Git-Tag: 1.19.3~285 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8e8d98ff9e303e2793fa634ad5e9ff0ed7be9bb;p=platform%2Fupstream%2Fgstreamer.git tests: aggregator: Take `TIMEOUT_FACTOR` env var into account This env var is set in the CI so we grow the timeout as required (when running in valgrind for example). Trying to avoid hitting wrong timeout in valgrind job like in: https://gitlab.freedesktop.org/tpm/gstreamer/-/jobs/14009456 Part-of: --- diff --git a/subprojects/gstreamer/tests/check/libs/aggregator.c b/subprojects/gstreamer/tests/check/libs/aggregator.c index e51ffcb..23ca1ad 100644 --- a/subprojects/gstreamer/tests/check/libs/aggregator.c +++ b/subprojects/gstreamer/tests/check/libs/aggregator.c @@ -24,6 +24,7 @@ # include "config.h" #endif +#include #include #include @@ -441,6 +442,9 @@ _test_chain (GstPad * pad, GstObject * object, GstBuffer * buffer) static void _test_data_init (TestData * test, gboolean needs_flushing) { + const gchar *timeout_factor_str = g_getenv ("TIMEOUT_FACTOR"); + gint timeout = 1000; + test->aggregator = gst_element_factory_make ("testaggregator", NULL); gst_element_set_state (test->aggregator, GST_STATE_PLAYING); test->ml = g_main_loop_new (NULL, TRUE); @@ -465,8 +469,14 @@ _test_data_init (TestData * test, gboolean needs_flushing) (GstPadProbeCallback) _aggregated_cb, test->ml, NULL); } + if (timeout_factor_str) { + gint factor = g_ascii_strtoll (timeout_factor_str, NULL, 10); + if (factor) + timeout *= factor; + } + test->timeout_id = - g_timeout_add (1000, (GSourceFunc) _aggregate_timeout, test->ml); + g_timeout_add (timeout, (GSourceFunc) _aggregate_timeout, test->ml); } static void