|
|
|
|
@ -13,6 +13,7 @@
|
|
|
|
|
#include "tun_if.h" |
|
|
|
|
#include "debug_config.h" |
|
|
|
|
#include "mem.h" |
|
|
|
|
#include "test_clock.h" |
|
|
|
|
#ifndef _WIN32 |
|
|
|
|
#include <unistd.h> |
|
|
|
|
#else |
|
|
|
|
@ -62,7 +63,8 @@ int __wrap_etcp_route_send(struct UTUN_INSTANCE* inst, uint64_t group, uint64_t
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void pump(void) { for (int i = 0; i < 12; i++) uasync_poll(ua, 1); } |
|
|
|
|
// Сохраняем 12мс на обработку событий и проверку отсутствия преждевременных ответов.
|
|
|
|
|
static void pump(void) { test_clock_run_for(ua, 120); } |
|
|
|
|
|
|
|
|
|
static socket_t listen_local(uint16_t* port) { |
|
|
|
|
socket_t fd = socket(AF_INET, SOCK_STREAM, 0); |
|
|
|
|
@ -520,6 +522,7 @@ static void tun_tests(struct UTUN_INSTANCE* inst) {
|
|
|
|
|
int main(void) { |
|
|
|
|
debug_config_init(); debug_set_level(DEBUG_LEVEL_WARN); |
|
|
|
|
if (getenv("UTUN_TEST_DEBUG")) debug_set_category_level(DEBUG_CATEGORY_PROXY, DEBUG_LEVEL_DEBUG); |
|
|
|
|
test_clock_init(100); |
|
|
|
|
CHECK(socket_platform_init() == 0); |
|
|
|
|
ua = uasync_create(); CHECK(ua); |
|
|
|
|
struct UTUN_INSTANCE* inst = u_calloc(1, sizeof(*inst)); CHECK(inst); |
|
|
|
|
@ -528,5 +531,6 @@ int main(void) {
|
|
|
|
|
u_free(inst); pump(); uasync_destroy(ua, 0); |
|
|
|
|
CHECK(u_get_allocated_count() == 0); |
|
|
|
|
socket_platform_cleanup(); |
|
|
|
|
test_clock_finish(); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|