aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-02-08 11:19:04 +0100
committerMaria Matejka <mq@ucw.cz>2019-07-09 14:37:14 +0200
commit1322e205e2066c0da8526bed505dc699d0f5b92a (patch)
tree387c7aeaafd5eccde69e9df851dea3e77d5c0c24 /test
parentbb001af0e8022f6445ff50b7f32c9ac102cc244e (diff)
downloadbird-1322e205e2066c0da8526bed505dc699d0f5b92a.tar.gz
Test: Fixed annoying warnings (and possible obscure bugs).
Diffstat (limited to 'test')
-rw-r--r--test/birdtest.c5
-rw-r--r--test/birdtest.h4
2 files changed, 4 insertions, 5 deletions
diff --git a/test/birdtest.c b/test/birdtest.c
index d503890a..7b6fb0b5 100644
--- a/test/birdtest.c
+++ b/test/birdtest.c
@@ -149,10 +149,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 b2d572d0..dacfb095 100644
--- a/test/birdtest.h
+++ b/test/birdtest.h
@@ -55,11 +55,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__)