You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
300 lines
11 KiB
300 lines
11 KiB
# Tests Makefile.am for utun - all tests with new ll_queue library |
|
|
|
# All available tests |
|
check_PROGRAMS = \ |
|
test_etcp_crypto \ |
|
test_etcp_two_instances \ |
|
test_etcp_simple_traffic \ |
|
test_etcp_minimal \ |
|
test_etcp_100_packets \ |
|
test_pkt_normalizer_etcp \ |
|
test_pkt_normalizer_standalone \ |
|
test_etcp_api \ |
|
test_ll_queue \ |
|
test_intensive_memory_pool \ |
|
test_memory_pool_and_config \ |
|
test_packet_dump \ |
|
test_u_async_comprehensive \ |
|
test_u_async_performance \ |
|
test_u_async_timeouts \ |
|
test_debug_categories \ |
|
test_config_debug \ |
|
test_route_lib \ |
|
test_bgp_route_exchange \ |
|
test_routing_mesh \ |
|
bench_timeout_heap \ |
|
bench_uasync_timeouts |
|
|
|
# test_crypto and test_ecc_encrypt only needed for TinyCrypt (not when using OpenSSL) |
|
if USE_OPENSSL |
|
else |
|
check_PROGRAMS += test_crypto test_ecc_encrypt |
|
endif |
|
|
|
# Basic includes |
|
AM_CFLAGS = -g -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
|
|
# TinyCrypt source files |
|
TINYCRYPT_SRCDIR = $(top_srcdir)/tinycrypt/lib/source |
|
|
|
# TinyCrypt object files (built by src/Makefile.am with utun- prefix) |
|
TINYCRYPT_OBJS = \ |
|
$(top_builddir)/src/utun-aes_encrypt.o \ |
|
$(top_builddir)/src/utun-aes_decrypt.o \ |
|
$(top_builddir)/src/utun-ccm_mode.o \ |
|
$(top_builddir)/src/utun-cmac_mode.o \ |
|
$(top_builddir)/src/utun-ctr_mode.o \ |
|
$(top_builddir)/src/utun-ecc.o \ |
|
$(top_builddir)/src/utun-ecc_dh.o \ |
|
$(top_builddir)/src/utun-ecc_dsa.o \ |
|
$(top_builddir)/src/utun-sha256.o \ |
|
$(top_builddir)/src/utun-ecc_platform_specific.o \ |
|
$(top_builddir)/src/utun-utils.o |
|
|
|
# Secure channel and CRC objects (built in src directory) |
|
SECURE_CHANNEL_OBJS = $(top_builddir)/src/utun-secure_channel.o $(top_builddir)/src/utun-crc32.o |
|
|
|
# ETCP core objects |
|
ETCP_CORE_OBJS = \ |
|
$(top_builddir)/src/utun-etcp.o \ |
|
$(top_builddir)/src/utun-etcp_connections.o \ |
|
$(top_builddir)/src/utun-etcp_loadbalancer.o \ |
|
$(top_builddir)/src/utun-pkt_normalizer.o \ |
|
$(top_builddir)/src/utun-etcp_api.o \ |
|
$(top_builddir)/src/utun-etcp_debug.o |
|
|
|
# Platform-specific TUN objects |
|
if OS_WINDOWS |
|
TUN_PLATFORM_OBJ = $(top_builddir)/src/utun-tun_windows.o |
|
else |
|
if OS_FREEBSD |
|
TUN_PLATFORM_OBJ = $(top_builddir)/src/utun-tun_freebsd.o |
|
else |
|
TUN_PLATFORM_OBJ = $(top_builddir)/src/utun-tun_linux.o |
|
endif |
|
endif |
|
|
|
# Full ETCP objects |
|
ETCP_FULL_OBJS = \ |
|
$(top_builddir)/src/utun-config_parser.o \ |
|
$(top_builddir)/src/utun-config_updater.o \ |
|
$(top_builddir)/src/utun-route_lib.o \ |
|
$(top_builddir)/src/utun-route_bgp.o \ |
|
$(top_builddir)/src/utun-route_node.o \ |
|
$(top_builddir)/src/utun-routing.o \ |
|
$(top_builddir)/src/utun-tun_if.o \ |
|
$(top_builddir)/src/utun-tun_route.o \ |
|
$(top_builddir)/src/utun-packet_dump.o \ |
|
$(top_builddir)/src/utun-firewall.o \ |
|
$(TUN_PLATFORM_OBJ) \ |
|
$(top_builddir)/src/utun-utun_instance.o \ |
|
$(ETCP_CORE_OBJS) |
|
|
|
# Windows-specific libraries (advapi32 for CryptGenRandom, ws2_32 for sockets) |
|
if OS_WINDOWS |
|
WIN_LIBS = -lws2_32 -liphlpapi -ladvapi32 -lbcrypt -ldbghelp |
|
else |
|
WIN_LIBS = |
|
endif |
|
|
|
# Common libraries (libuasync.a from lib directory) |
|
COMMON_LIBS = $(top_builddir)/src/utun-control_server.o $(top_builddir)/lib/libuasync.a -lpthread $(WIN_LIBS) |
|
|
|
# Crypto libraries (conditional) |
|
if USE_OPENSSL |
|
CRYPTO_LIBS = -lcrypto |
|
TINYCRYPT_BUILT = |
|
else |
|
CRYPTO_LIBS = $(TINYCRYPT_OBJS) |
|
TINYCRYPT_BUILT = tinycrypt-objects |
|
endif |
|
|
|
# Register tests |
|
TESTS = $(check_PROGRAMS) |
|
|
|
# Build TinyCrypt objects as a group (only when not using OpenSSL) |
|
if USE_OPENSSL |
|
else |
|
tinycrypt-objects: $(TINYCRYPT_OBJS) |
|
endif |
|
|
|
# Ensure TinyCrypt objects are built before tests that need them |
|
if USE_OPENSSL |
|
BUILT_SOURCES = |
|
else |
|
BUILT_SOURCES = $(TINYCRYPT_OBJS) |
|
|
|
$(TINYCRYPT_OBJS): $(top_builddir)/src/utun |
|
@$(MAKE) -C $(top_builddir)/src tinycrypt-objects |
|
endif |
|
|
|
# Test definitions |
|
test_etcp_crypto_SOURCES = test_etcp_crypto.c |
|
test_etcp_crypto_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_etcp_crypto_LDADD = $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
if USE_OPENSSL |
|
else |
|
test_crypto_SOURCES = test_crypto.c |
|
test_crypto_CFLAGS = -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source -I$(top_srcdir)/lib |
|
test_crypto_LDADD = $(TINYCRYPT_OBJS) $(COMMON_LIBS) |
|
endif |
|
|
|
test_etcp_two_instances_SOURCES = test_etcp_two_instances.c |
|
test_etcp_two_instances_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_etcp_two_instances_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_etcp_simple_traffic_SOURCES = test_etcp_simple_traffic.c |
|
test_etcp_simple_traffic_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_etcp_simple_traffic_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_etcp_minimal_SOURCES = test_etcp_minimal.c |
|
test_etcp_minimal_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_etcp_minimal_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_etcp_100_packets_SOURCES = test_etcp_100_packets.c |
|
test_etcp_100_packets_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_etcp_100_packets_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_pkt_normalizer_etcp_SOURCES = test_pkt_normalizer_etcp.c |
|
test_pkt_normalizer_etcp_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_pkt_normalizer_etcp_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_pkt_normalizer_standalone_SOURCES = test_pkt_normalizer_standalone.c |
|
test_pkt_normalizer_standalone_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_pkt_normalizer_standalone_LDADD = $(top_builddir)/src/utun-pkt_normalizer.o $(top_builddir)/src/utun-route_lib.o $(top_builddir)/src/utun-route_node.o $(top_builddir)/src/utun-routing.o $(top_builddir)/src/utun-packet_dump.o $(top_builddir)/src/utun-etcp_api.o $(top_builddir)/src/utun-etcp_debug.o $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_etcp_api_SOURCES = test_etcp_api.c |
|
test_etcp_api_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_etcp_api_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_ll_queue_SOURCES = test_ll_queue.c |
|
test_ll_queue_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_ll_queue_LDADD = $(COMMON_LIBS) |
|
|
|
if USE_OPENSSL |
|
else |
|
test_ecc_encrypt_SOURCES = test_ecc_encrypt.c |
|
test_ecc_encrypt_CFLAGS = -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source -I$(top_srcdir)/lib |
|
test_ecc_encrypt_LDADD = $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) -lcrypto |
|
endif |
|
|
|
test_intensive_memory_pool_SOURCES = test_intensive_memory_pool.c |
|
test_intensive_memory_pool_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_intensive_memory_pool_LDADD = $(COMMON_LIBS) |
|
|
|
test_memory_pool_and_config_SOURCES = test_memory_pool_and_config.c |
|
test_memory_pool_and_config_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_memory_pool_and_config_LDADD = $(COMMON_LIBS) |
|
|
|
test_packet_dump_SOURCES = test_packet_dump.c |
|
test_packet_dump_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_packet_dump_LDADD = $(COMMON_LIBS) |
|
|
|
test_u_async_comprehensive_SOURCES = test_u_async_comprehensive.c |
|
test_u_async_comprehensive_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_u_async_comprehensive_LDADD = $(COMMON_LIBS) |
|
|
|
test_u_async_performance_SOURCES = test_u_async_performance.c |
|
test_u_async_performance_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_u_async_performance_LDADD = $(COMMON_LIBS) |
|
|
|
test_u_async_timeouts_SOURCES = test_u_async_timeouts.c |
|
test_u_async_timeouts_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_u_async_timeouts_LDADD = $(COMMON_LIBS) |
|
|
|
test_debug_categories_SOURCES = test_debug_categories.c |
|
test_debug_categories_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_debug_categories_LDADD = $(COMMON_LIBS) |
|
|
|
test_config_debug_SOURCES = test_config_debug.c |
|
test_config_debug_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_config_debug_LDADD = $(top_builddir)/src/utun-config_parser.o $(COMMON_LIBS) |
|
|
|
test_route_lib_SOURCES = test_route_lib.c |
|
test_route_lib_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
test_route_lib_LDADD = $(top_builddir)/src/utun-route_lib.o $(top_builddir)/src/utun-etcp_debug.o $(COMMON_LIBS) |
|
|
|
test_bgp_route_exchange_SOURCES = test_bgp_route_exchange.c |
|
test_bgp_route_exchange_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_bgp_route_exchange_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
test_routing_mesh_SOURCES = test_routing_mesh.c |
|
test_routing_mesh_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source |
|
test_routing_mesh_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS) |
|
|
|
# test_dummynet временно исключен (медленный) |
|
# test_dummynet_SOURCES = test_dummynet.c |
|
# test_dummynet_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib |
|
# test_dummynet_LDADD = $(top_builddir)/src/utun-dummynet.o $(COMMON_LIBS) |
|
|
|
bench_timeout_heap_SOURCES = bench_timeout_heap.c |
|
bench_timeout_heap_CFLAGS = -I$(top_srcdir)/lib |
|
bench_timeout_heap_LDADD = $(COMMON_LIBS) |
|
|
|
bench_uasync_timeouts_SOURCES = bench_uasync_timeouts.c |
|
bench_uasync_timeouts_CFLAGS = -I$(top_srcdir)/lib |
|
bench_uasync_timeouts_LDADD = $(COMMON_LIBS) |
|
|
|
# Build tinycrypt objects before tests that need them |
|
BUILT_SOURCES = $(TINYCRYPT_BUILT) |
|
|
|
# Copy test configs to build directory (tests run from build/tests/) |
|
all-local: copy-test-configs |
|
|
|
copy-test-configs: $(check_PROGRAMS) |
|
@for conf in $(srcdir)/test_*.conf $(srcdir)/test_*.json; do \ |
|
if test -f "$$conf"; then \ |
|
cp -f "$$conf" "$(top_builddir)/tests/" 2>/dev/null || true; \ |
|
fi; \ |
|
done 2>/dev/null || true |
|
|
|
# Clean |
|
clean-local: |
|
-rm -f $(check_PROGRAMS) |
|
-rm -f $(top_builddir)/tests/test_*.conf $(top_builddir)/tests/test_*.json 2>/dev/null || true |
|
-rm -rf $(top_builddir)/tests/logs 2>/dev/null || true |
|
|
|
# Test logs directory |
|
TEST_LOG_DIR = $(top_builddir)/tests/logs |
|
|
|
# Custom check target that runs tests and saves logs to files |
|
check-local: |
|
@$(MKDIR_P) $(TEST_LOG_DIR); \ |
|
passed=0; \ |
|
failed=0; \ |
|
skipped=0; \ |
|
total=0; \ |
|
failed_tests=""; \ |
|
for test in $(check_PROGRAMS); do \ |
|
total=$$((total + 1)); \ |
|
logfile="$(TEST_LOG_DIR)/$$test.log"; \ |
|
if test -f "./$$test"; then \ |
|
if "./$$test" > "$$logfile" 2>&1; then \ |
|
echo "[PASS] $$test"; \ |
|
passed=$$((passed + 1)); \ |
|
else \ |
|
echo "[FAIL] $$test (see $$logfile)"; \ |
|
failed=$$((failed + 1)); \ |
|
if test -z "$$failed_tests"; then \ |
|
failed_tests="$$test"; \ |
|
else \ |
|
failed_tests="$$failed_tests $$test"; \ |
|
fi; \ |
|
fi; \ |
|
else \ |
|
echo "[SKIP] $$test (not built)"; \ |
|
skipped=$$((skipped + 1)); \ |
|
fi; \ |
|
done; \ |
|
echo ""; \ |
|
echo "=========================================="; \ |
|
echo "Test Results: $$passed passed, $$failed failed, $$skipped skipped ($$total total)"; \ |
|
echo "Log directory: $(TEST_LOG_DIR)"; \ |
|
echo "=========================================="; \ |
|
if test $$failed -gt 0; then \ |
|
echo ""; \ |
|
echo "Failed tests: $$failed_tests"; \ |
|
echo "Run 'cat $(TEST_LOG_DIR)/<test>.log' to see details"; \ |
|
exit 1; \ |
|
fi
|
|
|