QUIC test fix
authorHugo Landau <hlandau@openssl.org>
Wed, 22 Mar 2023 18:46:55 +0000 (18:46 +0000)
committerHugo Landau <hlandau@openssl.org>
Thu, 30 Mar 2023 10:14:16 +0000 (11:14 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20348)

test/quicapitest.c

index 487e6fa9364b079c43e97b8e3b4f353af5e2d2cc..5f167aa382c1cd99d388542d8c1181d0cb7ca3c1 100644 (file)
@@ -65,13 +65,21 @@ static int test_quic_write_read(int idx)
         /* Check that sending and receiving app data is ok */
         if (!TEST_true(SSL_write_ex(clientquic, msg, msglen, &numbytes)))
             goto end;
-        if (idx == 1 && !TEST_true(wait_until_sock_readable(ssock)))
-            goto end;
-        ossl_quic_tserver_tick(qtserv);
-        if (!TEST_true(ossl_quic_tserver_read(qtserv, buf, sizeof(buf),
-                                                     &numbytes))
-                || !TEST_mem_eq(buf, numbytes, msg, msglen))
-            goto end;
+        if (idx == 1) {
+            do {
+                if (!TEST_true(wait_until_sock_readable(ssock)))
+                    goto end;
+
+                ossl_quic_tserver_tick(qtserv);
+
+                if (!TEST_true(ossl_quic_tserver_read(qtserv, buf, sizeof(buf),
+                                                      &numbytes)))
+                    goto end;
+            } while (numbytes == 0);
+
+            if (!TEST_mem_eq(buf, numbytes, msg, msglen))
+                goto end;
+        }
 
         if (!TEST_true(ossl_quic_tserver_write(qtserv, (unsigned char *)msg,
                                                msglen, &numbytes)))