Debug flaky unit test
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 6 Jun 2022 15:24:19 +0000 (17:24 +0200)
committerNoah Meyerhans <noahm@debian.org>
Sun, 10 Mar 2024 06:31:22 +0000 (22:31 -0800)
See #1007744

Gbp-Pq: Name Debug-flaky-unit-test.patch

src/lib-smtp/test-smtp-server-errors.c

index d3e528c063583495748302ca5ea8540801062395..5240d300f4da4748e9483ac1210460478be3b6a0 100644 (file)
@@ -3712,13 +3712,14 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 
 static void test_server_timeout(void *context ATTR_UNUSED)
 {
-       i_fatal("Server timed out");
+       i_fatal("Server timed out [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
 }
 
 static void test_server_run(const struct smtp_server_settings *smtp_set)
 {
        struct timeout *to;
 
+       i_debug("Adding timeout to server [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
        to = timeout_add(SERVER_MAX_TIMEOUT_MSECS,
                         test_server_timeout, NULL);
 
@@ -3729,8 +3730,7 @@ static void test_server_run(const struct smtp_server_settings *smtp_set)
 
        io_loop_run(ioloop);
 
-       if (debug)
-               i_debug("Server finished");
+       i_debug("Server finished [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
 
        /* close server socket */
        io_remove(&io_listen);
@@ -3770,9 +3770,12 @@ static int test_run_client(struct test_client_data *data)
        /* wait a little for server setup */
        i_sleep_msecs(100);
 
+       i_debug("test_run_client: pre create [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
        ioloop = io_loop_create();
+       i_debug("test_run_client: post create [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
        data->client_test(data->index);
        io_loop_destroy(&ioloop);
+       i_debug("test_run_client: post destroy [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
 
        if (debug)
                i_debug("Terminated");
@@ -3794,9 +3797,12 @@ test_run_server(const struct smtp_server_settings *server_set,
        i_zero(&server_callbacks);
 
        server_pending = client_tests_count;
+       i_debug("test_run_server: pre create [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
        ioloop = io_loop_create();
+       i_debug("test_run_server: post create [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
        server_test(server_set);
        io_loop_destroy(&ioloop);
+       i_debug("test_run_server: post destroy create [current_ioloop=%p ioloop=%p]", current_ioloop, ioloop);
 
        if (debug)
                i_debug("Terminated");