[vlc-commits] test: dump core on timeout

Thomas Guillem git at videolan.org
Wed Nov 28 11:09:40 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Nov 27 14:55:57 2018 +0100| [6fec0cfefcef1b4b5c807bd936765f6d4acf489d] | committer: Thomas Guillem

test: dump core on timeout

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

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

diff --git a/test/libvlc/test.h b/test/libvlc/test.h
index 57bf787514..efd0b3294b 100644
--- a/test/libvlc/test.h
+++ b/test/libvlc/test.h
@@ -41,7 +41,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <unistd.h>
-
+#include <signal.h>
 
 /*********************************************************************
  * Some useful global var
@@ -65,6 +65,12 @@ static const char test_default_video[] = SRCDIR"/samples/image.jpg";
 
 #define test_log( ... ) printf( "testapi: " __VA_ARGS__ );
 
+static inline void on_timeout(int signum)
+{
+    assert(signum == SIGALRM);
+    abort(); /* Cause a core dump */
+}
+
 static inline void test_init (void)
 {
     (void)test_default_sample; /* This one may not be used */
@@ -84,7 +90,13 @@ static inline void test_init (void)
             alarm_timeout = val;
     }
     if (alarm_timeout != 0)
+    {
+        struct sigaction sig = {
+            .sa_handler = on_timeout,
+        };
+        sigaction(SIGALRM, &sig, NULL);
         alarm (alarm_timeout);
+    }
 
     setenv( "VLC_PLUGIN_PATH", "../modules", 1 );
 }



More information about the vlc-commits mailing list