| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include <pj/os.h> |
| 20 |
#include <pj/argparse.h> |
| 21 |
|
| 22 |
#include "test.h" |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 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 |
} |