Debian Codegraph @

Xpjproject/pjmedia/src/test/main.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include <pj/os.h>
20 #include <pj/argparse.h>
21
22 #include "test.h"
23
24
25 /* Any tests that want to build a linked executable for RTEMS must include
26 this header to get a default config for the network stack. */
27 #if defined(PJ_RTEMS)
28 # include <bsp.h>
29 # include <rtems.h>
30 # include <rtems/rtems_bsdnet.h>
31 # include "../../../pjlib/include/rtems-network-config.h"
32 #endif
33
34
35 static void usage()
36 {
37 puts("Usage:");
38 puts(" pjmedia-test [OPTIONS] [test_to_run] [test to run] [..]");
39 puts("");
40 puts("where OPTIONS:");
41 puts("");
42 puts(" -h, --help Show this help screen");
43
44 ut_usage();
45
46 puts(" -i Ask ENTER before quitting");
47 }
48
49
50 static int main_func(int argc, char *argv[])
51 {
52 int rc;
53 int interractive = 0;
54
55 if (pj_argparse_get_bool(&argc, argv, "-h") ||
56 pj_argparse_get_bool(&argc, argv, "--help"))
57 {
58 usage();
59 return 0;
60 }
61
62 ut_app_init0(&test_app.ut_app);
63
64 interractive = pj_argparse_get_bool(&argc, argv, "-i");
65 if (ut_parse_args(&test_app.ut_app, &argc, argv))
66 return 1;
67
68 rc = test_main(argc, argv);
69
70 if (interractive) {
71 char s[10];
72 puts("");
73 puts("Press <ENTER> to exit");
74 if (!fgets(s, sizeof(s), stdin))
75 return rc;
76 }
77
78 return rc;
79 }
80
81 int main(int argc, char *argv[])
82 {
83 return pj_run_app(&main_func, argc, argv, 0);
84 }