From 1b2632f968adbf9c488e7972d9f40d668f450513 Mon Sep 17 00:00:00 2001 From: TapTap Date: Tue, 15 Sep 2026 23:38:15 +0200 Subject: [PATCH] test: fix merged parity branches (4-section manifest fixtures, timeout-teardown) --- tests/test_config.c | 2 +- tests/test_server.c | 4 ++++ tests/test_transport_tcp.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_config.c b/tests/test_config.c index fa2e6a8..e181b79 100644 --- a/tests/test_config.c +++ b/tests/test_config.c @@ -2693,7 +2693,7 @@ static void golden_config_populate(Config* c) { * one report_dest_info bool, and other wire changes landing in this version); * the byte-exact values are recomputed for the merged layout. */ #define GOLDEN_WIRE_LEN 697 -#define GOLDEN_WIRE_HASH 0ULL +#define GOLDEN_WIRE_HASH 7835017034643051109ULL static unsigned long long fnv1a_64(const unsigned char* buf, size_t len) { unsigned long long h = 1469598103934665603ULL; diff --git a/tests/test_server.c b/tests/test_server.c index 706b88c..aa680a4 100644 --- a/tests/test_server.c +++ b/tests/test_server.c @@ -582,6 +582,7 @@ static void test_late_manifest_abort_frees_keepset() { EXPECT_TRUE(send_str(p[1], "keep.txt")); EXPECT_TRUE(send_int(p[1], 0)); /* protected-prefix section is empty */ EXPECT_TRUE(send_int(p[1], 0)); /* missing-args section is empty */ + EXPECT_TRUE(send_int(p[1], 0)); /* synchronized-directories section is empty */ EXPECT_TRUE(send_status(p[1], STATUS_ABORT)); DeleteManifest* pending = NULL; @@ -606,6 +607,7 @@ static void test_late_manifest_eof_frees_keepset() { EXPECT_TRUE(send_str(p[1], "keep.txt")); EXPECT_TRUE(send_int(p[1], 0)); /* protected-prefix section is empty */ EXPECT_TRUE(send_int(p[1], 0)); /* missing-args section is empty */ + EXPECT_TRUE(send_int(p[1], 0)); /* synchronized-directories section is empty */ shutdown(p[1], SHUT_WR); DeleteManifest* pending = NULL; @@ -630,11 +632,13 @@ static void test_late_second_manifest_frees_both() { EXPECT_TRUE(send_str(p[1], "first.txt")); EXPECT_TRUE(send_int(p[1], 0)); /* protected-prefix section is empty */ EXPECT_TRUE(send_int(p[1], 0)); /* missing-args section is empty */ + EXPECT_TRUE(send_int(p[1], 0)); /* synchronized-directories section is empty */ EXPECT_TRUE(send_status(p[1], STATUS_MANIFEST)); EXPECT_TRUE(send_int(p[1], 1)); EXPECT_TRUE(send_str(p[1], "second.txt")); EXPECT_TRUE(send_int(p[1], 0)); /* protected-prefix section is empty */ EXPECT_TRUE(send_int(p[1], 0)); /* missing-args section is empty */ + EXPECT_TRUE(send_int(p[1], 0)); /* synchronized-directories section is empty */ DeleteManifest* pending = NULL; EXPECT_EQ_INT(run_pending_receiver(cfg, p[0], &pending), -1); diff --git a/tests/test_transport_tcp.c b/tests/test_transport_tcp.c index c6fd1fa..825a6c4 100644 --- a/tests/test_transport_tcp.c +++ b/tests/test_transport_tcp.c @@ -156,6 +156,9 @@ static void test_tcp_set_timeouts() { tcp_set_timeouts(-1, -1); EXPECT_EQ_INT(tcp_get_timeout_sec(), 0); EXPECT_EQ_INT(tcp_get_contimeout_sec(), 0); + /* Restore finite defaults so later tests that rely on a bounded connect/IO + * timeout (e.g. connecting to a non-routable address) cannot block forever. */ + tcp_set_timeouts(30, 10); } /* Test client_connect with an invalid host (should fail gracefully) */