summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2022-02-06 23:32:15 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2022-02-06 23:42:10 +0100
commit53a25406878ed686a58ec3e7379d6cb45b784942 (patch)
tree2a7407857137b8a30cd27c8c4e5dd7e1a160bf97 /test
parent4c6ee53f31a7ac667bc597b0fe19b6365abad415 (diff)
parent24600c642a1f50e2404f4d9dd98bd8a0c9844860 (diff)
Merge branch 'oz-trie-table'
Diffstat (limited to 'test')
-rw-r--r--test/birdtest.c15
-rw-r--r--test/birdtest.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/test/birdtest.c b/test/birdtest.c
index a1da078f..6ad743ce 100644
--- a/test/birdtest.c
+++ b/test/birdtest.c
@@ -309,6 +309,12 @@ bt_log_suite_case_result(int result, const char *fmt, ...)
}
}
+void
+bt_reset_suite_case_timer(void)
+{
+ clock_gettime(CLOCK_MONOTONIC, &bt_suite_case_begin);
+}
+
int
bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg, int forked, int timeout, const char *dsc, ...)
{
@@ -501,6 +507,15 @@ bt_fmt_ipa(char *buf, size_t size, const void *data)
bsnprintf(buf, size, "(null)");
}
+void
+bt_format_net(char *buf, size_t size, const void *data)
+{
+ if (data)
+ bsnprintf(buf, size, "%N", (const net_addr *) data);
+ else
+ bsnprintf(buf, size, "(null)");
+}
+
int
bt_is_char(byte c)
{
diff --git a/test/birdtest.h b/test/birdtest.h
index caec529b..ad5f8f9c 100644
--- a/test/birdtest.h
+++ b/test/birdtest.h
@@ -32,6 +32,7 @@ extern const char *bt_test_id;
void bt_init(int argc, char *argv[]);
int bt_exit_value(void);
+void bt_reset_suite_case_timer(void);
int bt_test_suite_base(int (*test_fn)(const void *), const char *test_id, const void *test_fn_argument, int forked, int timeout, const char *dsc, ...);
static inline u64 bt_random(void)
{ return ((u64) random() & 0xffffffff) | ((u64) random() << 32); }
@@ -165,6 +166,8 @@ struct bt_batch {
void bt_fmt_str(char *buf, size_t size, const void *data);
void bt_fmt_unsigned(char *buf, size_t size, const void *data);
void bt_fmt_ipa(char *buf, size_t size, const void *data);
+void bt_format_net(char *buf, size_t size, const void *data);
+
int bt_assert_batch__(struct bt_batch *opts);
int bt_is_char(byte c);