[vlc-commits] test: configure timeout with an env variable

Thomas Guillem git at videolan.org
Mon Nov 26 14:48:15 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov 26 10:22:05 2018 +0100| [60f85071d467863f1400db43d418e1c21aadaafb] | committer: Thomas Guillem

test: configure timeout with an env variable

VLC_TEST_TIMEOUT=n
n <= 0 for an infinite timeout
n > 0 for a timeout of n seconds.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60f85071d467863f1400db43d418e1c21aadaafb
---

 test/libvlc/test.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/test/libvlc/test.h b/test/libvlc/test.h
index 7be53e1417..57bf787514 100644
--- a/test/libvlc/test.h
+++ b/test/libvlc/test.h
@@ -68,7 +68,24 @@ static const char test_default_video[] = SRCDIR"/samples/image.jpg";
 static inline void test_init (void)
 {
     (void)test_default_sample; /* This one may not be used */
-    alarm (10); /* Make sure "make check" does not get stuck */
+
+    /* Make sure "make check" does not get stuck */
+    /* Timeout of 10secs by default */
+    unsigned alarm_timeout = 10;
+    /* Valid timeout value are < 0, for infinite, and > 0, for the number of
+     * seconds */
+    char *alarm_timeout_str = getenv("VLC_TEST_TIMEOUT");
+    if (alarm_timeout_str)
+    {
+        int val = atoi(alarm_timeout_str);
+        if (val <= 0)
+            alarm_timeout = 0; /* infinite */
+        else
+            alarm_timeout = val;
+    }
+    if (alarm_timeout != 0)
+        alarm (alarm_timeout);
+
     setenv( "VLC_PLUGIN_PATH", "../modules", 1 );
 }
 



More information about the vlc-commits mailing list