Browse Source

tests: accelerate radio timers and run it among short checks

master
evgeny 1 week ago
parent
commit
361c7df812
  1. 5
      tests/Makefile.am
  2. 6
      tests/test_radio.c

5
tests/Makefile.am

@ -119,6 +119,7 @@ check_PROGRAMS += \
test_etcp_router \ test_etcp_router \
test_dm_worker \ test_dm_worker \
test_chat_join \ test_chat_join \
test_radio \
test_bgp_route_exchange \ test_bgp_route_exchange \
test_chat_sync_stress \ test_chat_sync_stress \
test_node_conn_direct test_node_conn_direct
@ -161,7 +162,6 @@ endif
# Длительные проверки и нагрузка. # Длительные проверки и нагрузка.
check_PROGRAMS += \ check_PROGRAMS += \
test_proxy_regressions \ test_proxy_regressions \
test_radio \
test_bbr_integration \ test_bbr_integration \
test_dm_media \ test_dm_media \
test_merkle_sync test_merkle_sync
@ -622,9 +622,10 @@ test_call_headless_SOURCES = test_call_headless.c
test_call_headless_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/chat -I$(top_srcdir)/src/dm -I$(top_srcdir)/src/call -I$(top_srcdir)/src/routing_layer -I$(top_srcdir)/src/transport_layer -I$(top_srcdir)/lib test_call_headless_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/chat -I$(top_srcdir)/src/dm -I$(top_srcdir)/src/call -I$(top_srcdir)/src/routing_layer -I$(top_srcdir)/src/transport_layer -I$(top_srcdir)/lib
test_call_headless_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS) test_call_headless_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS)
test_radio_SOURCES = test_radio.c test_radio_SOURCES = test_radio.c $(test_clock_sources)
test_radio_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/chat -I$(top_srcdir)/src/dm -I$(top_srcdir)/src/call -I$(top_srcdir)/src/radio -I$(top_srcdir)/src/routing_layer -I$(top_srcdir)/src/transport_layer -I$(top_srcdir)/lib test_radio_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/chat -I$(top_srcdir)/src/dm -I$(top_srcdir)/src/call -I$(top_srcdir)/src/radio -I$(top_srcdir)/src/routing_layer -I$(top_srcdir)/src/transport_layer -I$(top_srcdir)/lib
test_radio_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS) test_radio_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS)
test_radio_LDFLAGS = $(test_clock_ldflags)
test_radio_headless_SOURCES = test_radio_headless.c test_radio_headless_SOURCES = test_radio_headless.c
test_radio_headless_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/chat -I$(top_srcdir)/src/dm -I$(top_srcdir)/src/call -I$(top_srcdir)/src/radio -I$(top_srcdir)/src/routing_layer -I$(top_srcdir)/src/transport_layer -I$(top_srcdir)/lib test_radio_headless_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/chat -I$(top_srcdir)/src/dm -I$(top_srcdir)/src/call -I$(top_srcdir)/src/radio -I$(top_srcdir)/src/routing_layer -I$(top_srcdir)/src/transport_layer -I$(top_srcdir)/lib

6
tests/test_radio.c

@ -29,6 +29,7 @@
#include "../lib/mem.h" #include "../lib/mem.h"
#include "../lib/platform_compat.h" #include "../lib/platform_compat.h"
#include "test_utils.h" #include "test_utils.h"
#include "test_clock.h"
#include <sqlite3.h> #include <sqlite3.h>
#define OPENSSL_API_COMPAT 0x10100000L #define OPENSSL_API_COMPAT 0x10100000L
@ -571,6 +572,8 @@ int main(int argc, char** argv) {
debug_set_category_level_by_name("member_sync", "info"); debug_set_category_level_by_name("member_sync", "info");
debug_set_category_level_by_name("chat_sync", "info"); debug_set_category_level_by_name("chat_sync", "info");
} }
test_clock_init(TICK_TB);
test_clock_sync_wall_time();
utun_instance_set_tun_init_enabled(0); utun_instance_set_tun_init_enabled(0);
srand((unsigned)time(NULL)); srand((unsigned)time(NULL));
@ -616,7 +619,7 @@ int main(int argc, char** argv) {
radio_set_frame_cb(t.inst[IDX_C], rx_frame_cb, &g_rx[IDX_C]); radio_set_frame_cb(t.inst[IDX_C], rx_frame_cb, &g_rx[IDX_C]);
t.timer = uasync_set_timeout(ua, TICK_TB, &t, rad_tick, "rad_tick"); t.timer = uasync_set_timeout(ua, TICK_TB, &t, rad_tick, "rad_tick");
uasync_mainloop(ua); test_clock_mainloop(ua);
int ok = (t.result == 1); int ok = (t.result == 1);
@ -631,5 +634,6 @@ int main(int argc, char** argv) {
char cmd[512]; snprintf(cmd, sizeof(cmd), "rm -rf %s", dir); (void)!system(cmd); char cmd[512]; snprintf(cmd, sizeof(cmd), "rm -rf %s", dir); (void)!system(cmd);
printf("\n%d/%d passed, %d failed\n", G_PASSED, G_TOTAL, G_FAILED); printf("\n%d/%d passed, %d failed\n", G_PASSED, G_TOTAL, G_FAILED);
test_clock_finish();
return G_FAILED > 0 ? 1 : 0; return G_FAILED > 0 ? 1 : 0;
} }

Loading…
Cancel
Save