summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/filter_test.c2
-rw-r--r--test/birdtest.c5
-rw-r--r--test/birdtest.h4
3 files changed, 5 insertions, 6 deletions
diff --git a/filter/filter_test.c b/filter/filter_test.c
index 54ea3e9b..a02f0832 100644
--- a/filter/filter_test.c
+++ b/filter/filter_test.c
@@ -35,7 +35,7 @@ parse_config_file(const void *argv)
const struct parse_config_file_arg *arg = argv;
size_t fn_size = strlen(arg->filename) + 1;
char *filename = alloca(fn_size);
- strncpy(filename, arg->filename, fn_size);
+ memcpy(filename, arg->filename, fn_size);
*(arg->cp) = bt_config_file_parse(filename);
return !!*(arg->cp);
diff --git a/test/birdtest.c b/test/birdtest.c
index a4312e9b..347f79b9 100644
--- a/test/birdtest.c
+++ b/test/birdtest.c
@@ -155,10 +155,7 @@ int bt_run_test_fn(int (*fn)(const void *), const void *fn_arg, int timeout)
int result;
alarm(timeout);
- if (fn_arg)
- result = fn(fn_arg);
- else
- result = ((int (*)(void))fn)();
+ result = fn(fn_arg);
if (!bt_suite_result)
result = 0;
diff --git a/test/birdtest.h b/test/birdtest.h
index 4443bfc1..18228711 100644
--- a/test/birdtest.h
+++ b/test/birdtest.h
@@ -54,11 +54,13 @@ void bt_log_suite_case_result(int result, const char *fmt, ...);
#define BT_PROMPT_FAIL_NO_COLOR " [" "FAIL" "] "
#define BT_PROMPT_OK_FAIL_STRLEN 8 /* strlen ' [FAIL] ' */
+static inline int bt_test_fn_noarg(const void *cp) { return ((int (*)(void)) cp)(); }
+
#define bt_test_suite(fn, dsc, ...) \
bt_test_suite_extra(fn, BT_FORKING, BT_TIMEOUT, dsc, ##__VA_ARGS__)
#define bt_test_suite_extra(fn, f, t, dsc, ...) \
- bt_test_suite_base((int (*)(const void *))fn, #fn, NULL, f, t, dsc, ##__VA_ARGS__)
+ bt_test_suite_base(bt_test_fn_noarg, #fn, fn, f, t, dsc, ##__VA_ARGS__)
#define bt_test_suite_arg(fn, arg, dsc, ...) \
bt_test_suite_arg_extra(fn, arg, BT_FORKING, BT_TIMEOUT, dsc, ##__VA_ARGS__)