qml: distinct the "album" view from the album component used in other view
[vlc.git] / test / libvlc / test.h
blob9d58d0d3285d91d864dbd981a9c1a5ea0541629d
1 /*
2 * test.h - libvlc smoke test common definitions
4 */
6 /**********************************************************************
7 * Copyright (C) 2007 RĂ©mi Denis-Courmont. *
8 * Copyright (C) 2008 Pierre d'Herbemont. *
9 * This program is free software; you can redistribute and/or modify *
10 * it under the terms of the GNU General Public License as published *
11 * by the Free Software Foundation; version 2 of the license, or (at *
12 * your option) any later version. *
13 * *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
17 * See the GNU General Public License for more details. *
18 * *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, you can get it from: *
21 * http://www.gnu.org/copyleft/gpl.html *
22 **********************************************************************/
24 #ifndef TEST_H
25 #define TEST_H
27 /*********************************************************************
28 * Some useful common headers
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34 #include <vlc/vlc.h>
36 #undef NDEBUG
37 #include <assert.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <stdbool.h>
42 #include <unistd.h>
43 #include <signal.h>
45 /*********************************************************************
46 * Some useful global var
49 static const char * test_defaults_args[] = {
50 "-v", "--vout=vdummy",
53 static const int test_defaults_nargs =
54 sizeof (test_defaults_args) / sizeof (test_defaults_args[0]);
56 /*static const char test_default_sample[] = "samples/test.sample";*/
57 static const char test_default_sample[] = SRCDIR"/samples/empty.voc";
58 static const char test_default_video[] = SRCDIR"/samples/image.jpg";
61 /*********************************************************************
62 * Some useful common functions
65 #define test_log( ... ) printf( "testapi: " __VA_ARGS__ );
67 static inline void on_timeout(int signum)
69 assert(signum == SIGALRM);
70 abort(); /* Cause a core dump */
73 static inline void test_init (void)
75 (void)test_default_sample; /* This one may not be used */
77 /* Make sure "make check" does not get stuck */
78 /* Timeout of 10secs by default */
79 unsigned alarm_timeout = 10;
80 /* Valid timeout value are < 0, for infinite, and > 0, for the number of
81 * seconds */
82 char *alarm_timeout_str = getenv("VLC_TEST_TIMEOUT");
83 if (alarm_timeout_str)
85 int val = atoi(alarm_timeout_str);
86 if (val <= 0)
87 alarm_timeout = 0; /* infinite */
88 else
89 alarm_timeout = val;
91 if (alarm_timeout != 0)
93 struct sigaction sig = {
94 .sa_handler = on_timeout,
96 sigaction(SIGALRM, &sig, NULL);
97 alarm (alarm_timeout);
100 setenv( "VLC_PLUGIN_PATH", "../modules", 1 );
103 #endif /* TEST_H */