2 * test.h - libvlc smoke test common definitions
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. *
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. *
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 **********************************************************************/
27 /*********************************************************************
28 * Some useful common headers
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
82 char *alarm_timeout_str
= getenv("VLC_TEST_TIMEOUT");
83 if (alarm_timeout_str
)
85 int val
= atoi(alarm_timeout_str
);
87 alarm_timeout
= 0; /* infinite */
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 );