]> git.sesse.net Git - vlc/blobdiff - test/libvlc/test.h
Do not assert memory allocations
[vlc] / test / libvlc / test.h
index 9cec504b42e192a7823c75aad95cf54d4b13bbe2..f706d3ea2b95596eb5cda3662fc4cfd11a6ca613 100644 (file)
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
-#include <vlc/libvlc.h>
+#include <vlc/vlc.h>
 
 #undef NDEBUG
 #include <assert.h>
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <unistd.h>
 
 
 static libvlc_exception_t ex;
 
 static const char * test_defaults_args[] = {
-    "-vvv",
+    "-v",
+    "--ignore-config",
     "-I",
     "dummy",
+    "--no-media-library",
     "--plugin-path=../modules",
     "--vout=dummy",
     "--aout=dummy"
@@ -59,7 +62,8 @@ static const char * test_defaults_args[] = {
 static const int test_defaults_nargs =
     sizeof (test_defaults_args) / sizeof (test_defaults_args[0]);
 
-static const char * test_default_sample = "samples/test.sample";
+/*static const char test_default_sample[] = "samples/test.sample";*/
+static const char test_default_sample[] = SRCDIR"/samples/empty.voc";
 
 
 /*********************************************************************
@@ -80,23 +84,22 @@ static inline bool have_exception (void)
         return false;
 }
 
-static inline void catch (void)
+#define catch() catch_with_info(__FILE__, __FUNCTION__, __LINE__)
+
+static inline void catch_with_info (const char * file, const char * func, unsigned line)
 {
     if (libvlc_exception_raised (&ex))
     {
-         fprintf (stderr, "Exception: %s\n",
-                  libvlc_exception_get_message (&ex));
+         fprintf (stderr, "%s:%s():%d Exception: %s\n", file, func, line, libvlc_errmsg ());
          abort ();
     }
-
-    assert (libvlc_exception_get_message (&ex) == NULL);
     libvlc_exception_clear (&ex);
 }
 
 static inline void test_init (void)
 {
     (void)test_default_sample; /* This one may not be used */
-    alarm (50); /* Make sure "make check" does not get stuck */
+    alarm (10); /* Make sure "make check" does not get stuck */
 }
 
 #endif /* TEST_H */