0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Test: Added -d flag to die directly after first error.

This commit is contained in:
Maria Matejka 2019-02-18 14:56:49 +01:00
parent d4bf74816f
commit d348a916f5

View File

@ -31,6 +31,7 @@
static const char *request; static const char *request;
static int list_tests; static int list_tests;
static int do_core; static int do_core;
static int do_die;
static int no_fork; static int no_fork;
static int no_timeout; static int no_timeout;
static int is_terminal; /* Whether stdout is a live terminal or pipe redirect */ static int is_terminal; /* Whether stdout is a live terminal or pipe redirect */
@ -67,7 +68,7 @@ bt_init(int argc, char *argv[])
bt_test_id = NULL; bt_test_id = NULL;
is_terminal = isatty(fileno(stdout)); is_terminal = isatty(fileno(stdout));
while ((c = getopt(argc, argv, "lcftv")) >= 0) while ((c = getopt(argc, argv, "lcdftv")) >= 0)
switch (c) switch (c)
{ {
case 'l': case 'l':
@ -78,6 +79,10 @@ bt_init(int argc, char *argv[])
do_core = 1; do_core = 1;
break; break;
case 'd':
do_die = 1;
break;
case 'f': case 'f':
no_fork = 1; no_fork = 1;
break; break;
@ -111,10 +116,11 @@ bt_init(int argc, char *argv[])
return; return;
usage: usage:
printf("Usage: %s [-l] [-c] [-f] [-t] [-vvv] [<test_suit_name>]\n", argv[0]); printf("Usage: %s [-l] [-c] [-d] [-f] [-t] [-vvv] [<test_suit_name>]\n", argv[0]);
printf("Options: \n"); printf("Options: \n");
printf(" -l List all test suite names and descriptions \n"); printf(" -l List all test suite names and descriptions \n");
printf(" -c Force unlimit core dumps (needs root privileges) \n"); printf(" -c Force unlimit core dumps (needs root privileges) \n");
printf(" -d Die on first failed test case \n");
printf(" -f No forking \n"); printf(" -f No forking \n");
printf(" -t No timeout limit \n"); printf(" -t No timeout limit \n");
printf(" -v More verbosity, maximum is 3 -vvv \n"); printf(" -v More verbosity, maximum is 3 -vvv \n");
@ -223,6 +229,9 @@ bt_log_result(int result, const char *fmt, va_list argptr)
result_str = is_terminal ? BT_PROMPT_FAIL : BT_PROMPT_FAIL_NO_COLOR; result_str = is_terminal ? BT_PROMPT_FAIL : BT_PROMPT_FAIL_NO_COLOR;
printf("%s\n", result_str); printf("%s\n", result_str);
if (do_die && !result)
abort();
} }
/** /**