From fd4c13f219df12f594486361bf9190fafc8bc2db Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 27 Oct 2026 05:35:27 +0100 Subject: [PATCH] test(chat): give diagnostic links a valid empty ACK queue --- tests/test_chat_member.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_chat_member.c b/tests/test_chat_member.c index 1c973502..f1834447 100644 --- a/tests/test_chat_member.c +++ b/tests/test_chat_member.c @@ -214,7 +214,10 @@ static void details(struct UTUN_INSTANCE* inst) { static void diagnostics(struct UTUN_INSTANCE* inst) { struct ETCP_CONN connection = {.instance = inst, .peer_node_id = 9, .unacked_bytes = UINT32_MAX}; struct ETCP_LINK* links = u_calloc(300, sizeof(*links)); assert(links); connection.links = links; - for (int i = 0; i < 300; i++) { links[i].etcp = &connection; links[i].next = i < 299 ? links + i + 1 : NULL; } + struct ll_queue* acks = queue_new(inst->ua, 0, 0, 0, "member_test_acks"); assert(acks); + for (int i = 0; i < 300; i++) { + links[i].etcp = &connection; links[i].ack_q = acks; links[i].next = i < 299 ? links + i + 1 : NULL; + } struct ll_entry* entry = queue_entry_new(sizeof(struct conn_queue_entry)); assert(entry); struct conn_queue_entry* item = (struct conn_queue_entry*)entry->data; item->peer_node_id = 9; item->conn = &connection; assert(!queue_data_put_with_index(inst->connections, entry)); expect_large_text = 1; unsigned before = text_events; @@ -223,7 +226,7 @@ static void diagnostics(struct UTUN_INSTANCE* inst) { assert(text_events == before + 2); target = "strbuf.c"; fault = F_REALLOCATE; chat_core_collect_status_trampoline(inst); assert(fault == F_NONE && text_events == before + 2); chat_core_collect_status_trampoline(inst); assert(text_events == before + 3); expect_large_text = 0; - queue_remove_data(inst->connections, entry); queue_entry_free(entry); u_free(links); + queue_remove_data(inst->connections, entry); queue_entry_free(entry); u_free(links); queue_free(acks); if (SIZE_MAX > UINT32_MAX) { size_t baseline = u_get_allocated_count(); struct strbuf text; strbuf_init(&text, (size_t)UINT32_MAX + 1); assert(!text.buf && !text.cap && !text.len && u_get_allocated_count() == baseline);