tests: accelerate proxy regression event waits

This commit is contained in:
evgeny committed 2026-10-10 15:08:47 +02:00
1 parent 9dc0c2deed
commit ea403442ab
2 files changed
+8 -4

No files matched your search

+3 -3
View File
@@ -116,6 +116,7 @@ check_PROGRAMS += \
test_dm_invite \
test_etcp_link_stress \
test_etcp_router_tcp \
test_proxy_regressions \
test_etcp_connect \
test_call \
test_group_connect \
@@ -158,7 +159,6 @@ check_PROGRAMS += \
# Длительные проверки и нагрузка.
check_PROGRAMS += \
test_proxy_regressions \
test_bbr_integration \
test_dm_media \
test_merkle_sync
@@ -840,9 +840,9 @@ test_proxy_packets_SOURCES = test_proxy_packets.c
test_proxy_packets_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS)
# Управляемый транспорт для граничных состояний proxy.
test_proxy_regressions_SOURCES = test_proxy_regressions.c
test_proxy_regressions_SOURCES = test_proxy_regressions.c $(test_clock_sources)
test_proxy_regressions_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS)
test_proxy_regressions_LDFLAGS = -Wl,--wrap=etcp_route_send -Wl,--wrap=uasync_set_timeout
test_proxy_regressions_LDFLAGS = $(test_clock_ldflags) -Wl,--wrap=etcp_route_send -Wl,--wrap=uasync_set_timeout
test_http_proxy_SOURCES = test_http_proxy.c ../src/proxy/http_proxy.c
test_http_proxy_LDADD = $(COMMON_LIBS)
+5 -1
View File
@@ -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;
}