From d943c0ddca70abcc2667ef0cc970dc11811d607c Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 26 Oct 2026 14:52:37 +0100 Subject: [PATCH] Poll diagnostic mesh tail after the original loop stops --- tests/test_radio_mesh.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_radio_mesh.c b/tests/test_radio_mesh.c index ca488c9b..5b27680c 100644 --- a/tests/test_radio_mesh.c +++ b/tests/test_radio_mesh.c @@ -160,7 +160,7 @@ static void mesh_snapshot(struct mesh_ctx* t, const char* reason) { } } -static void mesh_tail_stop(void* arg) { uasync_stop(arg); } +static void mesh_tail_stop(void* arg) { *(int*)arg = 1; } static int G_PASSED = 0, G_FAILED = 0, G_TOTAL = 0; #define TEST(n) do { G_TOTAL++; printf(" %-58s", n); fflush(stdout); } while(0) @@ -536,9 +536,10 @@ int main(int argc, char** argv) { /* Диагностический хвост не меняет сохранённый результат исходной проверки. */ if (getenv("UTUN_TEST_MESH_TAIL")) { DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "mesh observe tail=500ms original_ok=%d original_dupC=%u", ok, dup_c); - void* tail = uasync_set_timeout(ua, 5000, ua, mesh_tail_stop, "mesh_diagnostic_tail"); + int finished = 0; + void* tail = uasync_set_timeout(ua, 5000, &finished, mesh_tail_stop, "mesh_diagnostic_tail"); if (!tail) { DEBUG_ERROR(DEBUG_CATEGORY_DEBUG, "mesh: tail timer allocation failed"); abort(); } - uasync_mainloop(ua); + while (!finished) uasync_poll(ua, 100); mesh_snapshot(&t, "after_diagnostic_tail"); }