summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-12-17 00:01:53 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-12-17 00:01:53 +0100
commit3dabf7b8d09c3188ea41b7e2f763397946943778 (patch)
treecbff2eaaf2be437defb87ff0fcb77427295400d5 /test
parent3232d1718636eb7617fedc7b27378cd1d8f8691d (diff)
Test: Improve filter_test
Initial parsing of test.conf must be done directly in filter_test main, while reconfiguration is handled as a regular test. Also fix several minor issues in test code.
Diffstat (limited to 'test')
-rw-r--r--test/birdtest.c9
-rw-r--r--test/birdtest.h8
-rw-r--r--test/bt-utils.c2
3 files changed, 10 insertions, 9 deletions
diff --git a/test/birdtest.c b/test/birdtest.c
index 9e258c80..a092446a 100644
--- a/test/birdtest.c
+++ b/test/birdtest.c
@@ -117,6 +117,7 @@ bt_init(int argc, char *argv[])
}
clock_gettime(CLOCK_MONOTONIC, &bt_begin);
+ bt_suite_case_begin = bt_suite_begin = bt_begin;
return;
@@ -198,14 +199,13 @@ bt_log_result(int result, u64 time, const char *fmt, va_list argptr)
static char msg_buf[BT_BUFFER_SIZE];
char *pos;
- snprintf(msg_buf, sizeof(msg_buf), "%s%s%s%s %" PRIu64 ".%09" PRIu64 "s",
+ snprintf(msg_buf, sizeof(msg_buf), "%s%s%s %" PRIu64 ".%09" PRIu64 "s%s",
bt_filename,
bt_test_id ? ": " : "",
bt_test_id ? bt_test_id : "",
- (fmt && strlen(fmt) > 0) ? ": " : "",
time / 1000000000,
- time % 1000000000
- );
+ time % 1000000000,
+ (fmt && strlen(fmt) > 0) ? ": " : "");
pos = msg_buf + strlen(msg_buf);
if (fmt)
@@ -339,6 +339,7 @@ bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg,
bt_log("Starting");
clock_gettime(CLOCK_MONOTONIC, &bt_suite_begin);
+ bt_suite_case_begin = bt_suite_begin;
if (!forked)
{
diff --git a/test/birdtest.h b/test/birdtest.h
index dacfb095..caec529b 100644
--- a/test/birdtest.h
+++ b/test/birdtest.h
@@ -101,12 +101,12 @@ static inline int bt_test_fn_noarg(const void *cp) { return ((int (*)(void)) cp)
#define bt_assert_msg(test, format, ...) \
do \
{ \
- int bt_suit_case_result = 1; \
+ int bt_suit_case_result = 1; \
if ((test) == 0) \
{ \
- bt_result = 0; \
- bt_suite_result = 0; \
- bt_suit_case_result = 0; \
+ bt_result = 0; \
+ bt_suite_result = 0; \
+ bt_suit_case_result = 0; \
} \
bt_log_suite_case_result(bt_suit_case_result, format, ##__VA_ARGS__); \
} while (0)
diff --git a/test/bt-utils.c b/test/bt-utils.c
index 7653abf6..cbca3a6b 100644
--- a/test/bt-utils.c
+++ b/test/bt-utils.c
@@ -154,7 +154,7 @@ bt_config_parse__(struct config *cfg)
if (cfg->err_msg)
{
- bt_debug("Parse error %s, line %d: %s\n", cfg->err_file_name, cfg->err_lino, cfg->err_msg);
+ bt_log("Parse error %s, line %d: %s", cfg->err_file_name, cfg->err_lino, cfg->err_msg);
bt_show_cfg_error(cfg);
return NULL;
}