diff options
author | Daniel Salzman <daniel.salzman@nic.cz> | 2021-07-04 22:11:09 +0200 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2021-07-10 22:46:37 +0200 |
commit | 37824241477dddb9ceaed5bae8a6bdbcd1c1e3e3 (patch) | |
tree | 451413fb9a4530f20d2c6efd6b5c06e30a1775f1 /tests/libknot/test_xdp_tcp.c | |
parent | XDP-TCP: configuration cleanup (diff) | |
download | knot-37824241477dddb9ceaed5bae8a6bdbcd1c1e3e3.tar.xz knot-37824241477dddb9ceaed5bae8a6bdbcd1c1e3e3.zip |
XDP-TCP: move mock API from xdp.h to test_xdp_tcp.c
Diffstat (limited to 'tests/libknot/test_xdp_tcp.c')
-rw-r--r-- | tests/libknot/test_xdp_tcp.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/libknot/test_xdp_tcp.c b/tests/libknot/test_xdp_tcp.c index 03a6d0075..3b0abb513 100644 --- a/tests/libknot/test_xdp_tcp.c +++ b/tests/libknot/test_xdp_tcp.c @@ -20,8 +20,9 @@ #include "contrib/macros.h" #include "libknot/error.h" #include "libknot/xdp/msg_init.h" - #include "libknot/xdp/tcp.c" +#include "libknot/xdp/tcp_iobuf.c" +#include "libknot/xdp/bpf-user.h" knot_tcp_table_t *test_table = NULL; #define TEST_TABLE_SIZE 100 @@ -449,6 +450,14 @@ void test_ibufs_size(void) clean_table(); } +static void init_mock(knot_xdp_socket_t **socket, void *send_mock) +{ + *socket = calloc(1, sizeof(**socket)); + if (*socket != NULL) { + (*socket)->send_mock = send_mock; + } +} + int main(int argc, char *argv[]) { UNUSED(argc); @@ -458,8 +467,7 @@ int main(int argc, char *argv[]) test_table = knot_tcp_table_new(TEST_TABLE_SIZE); assert(test_table != NULL); - int ret = knot_xdp_init_mock(&test_sock, mock_send); - assert(ret == KNOT_EOK); + init_mock(&test_sock, mock_send); test_syn(); test_establish(); @@ -471,8 +479,7 @@ int main(int argc, char *argv[]) test_ibufs_size(); knot_xdp_deinit(test_sock); - ret = knot_xdp_init_mock(&test_sock, mock_send_nocheck); - assert(ret == KNOT_EOK); + init_mock(&test_sock, mock_send_nocheck); test_many(); knot_xdp_deinit(test_sock); |