diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-04-18 19:30:54 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-05-12 14:47:11 +0100 |
commit | b757beb5f326ce4a7da021d0f4c52e03e37e1945 (patch) | |
tree | a76654aa4195bf158e6aae90fd51808e3a10f24f /test | |
parent | e8fe7a21ea253408930d570ce00e6d3a78652162 (diff) | |
download | openssl-new-b757beb5f326ce4a7da021d0f4c52e03e37e1945.tar.gz |
QUIC TSERVER: Add support for multiple streams
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'test')
-rw-r--r-- | test/quic_tserver_test.c | 9 | ||||
-rw-r--r-- | test/quicapitest.c | 9 | ||||
-rw-r--r-- | test/quicfaultstest.c | 8 |
3 files changed, 16 insertions, 10 deletions
diff --git a/test/quic_tserver_test.c b/test/quic_tserver_test.c index a385381716..e9ae4703b2 100644 --- a/test/quic_tserver_test.c +++ b/test/quic_tserver_test.c @@ -215,16 +215,17 @@ static int do_test(int use_thread_assist, int use_fake_time, int use_inject) } if (c_connected && c_write_done && !s_read_done) { - if (!ossl_quic_tserver_read(tserver, + if (!ossl_quic_tserver_read(tserver, 0, (unsigned char *)msg2 + s_total_read, sizeof(msg2) - s_total_read, &l)) { - if (!TEST_true(ossl_quic_tserver_has_read_ended(tserver))) + if (!TEST_true(ossl_quic_tserver_has_read_ended(tserver, 0))) goto err; if (!TEST_mem_eq(msg1, sizeof(msg1) - 1, msg2, s_total_read)) goto err; s_begin_write = 1; + s_read_done = 1; } else { s_total_read += l; if (!TEST_size_t_le(s_total_read, sizeof(msg1) - 1)) @@ -233,7 +234,7 @@ static int do_test(int use_thread_assist, int use_fake_time, int use_inject) } if (s_begin_write && s_total_written < sizeof(msg1) - 1) { - if (!TEST_true(ossl_quic_tserver_write(tserver, + if (!TEST_true(ossl_quic_tserver_write(tserver, 0, (unsigned char *)msg2 + s_total_written, sizeof(msg1) - 1 - s_total_written, &l))) goto err; @@ -241,7 +242,7 @@ static int do_test(int use_thread_assist, int use_fake_time, int use_inject) s_total_written += l; if (s_total_written == sizeof(msg1) - 1) { - ossl_quic_tserver_conclude(tserver); + ossl_quic_tserver_conclude(tserver, 0); c_begin_read = 1; } } diff --git a/test/quicapitest.c b/test/quicapitest.c index 092e303ba6..3ce695e5e6 100644 --- a/test/quicapitest.c +++ b/test/quicapitest.c @@ -42,6 +42,7 @@ static int test_quic_write_read(int idx) size_t msglen = strlen(msg); size_t numbytes = 0; int ssock = 0, csock = 0; + uint64_t sid = UINT64_MAX; if (idx == 1 && !qtest_supports_blocking()) return TEST_skip("Blocking tests not supported in this build"); @@ -61,6 +62,10 @@ static int test_quic_write_read(int idx) goto end; } + if (!TEST_true(ossl_quic_tserver_stream_new(qtserv, /*is_uni=*/0, &sid)) + || !TEST_uint64_t_eq(sid, 1)) /* server-initiated, so first SID is 1 */ + goto end; + for (j = 0; j < 2; j++) { /* Check that sending and receiving app data is ok */ if (!TEST_true(SSL_write_ex(clientquic, msg, msglen, &numbytes))) @@ -72,7 +77,7 @@ static int test_quic_write_read(int idx) ossl_quic_tserver_tick(qtserv); - if (!TEST_true(ossl_quic_tserver_read(qtserv, buf, sizeof(buf), + if (!TEST_true(ossl_quic_tserver_read(qtserv, sid, buf, sizeof(buf), &numbytes))) goto end; } while (numbytes == 0); @@ -81,7 +86,7 @@ static int test_quic_write_read(int idx) goto end; } - if (!TEST_true(ossl_quic_tserver_write(qtserv, (unsigned char *)msg, + if (!TEST_true(ossl_quic_tserver_write(qtserv, sid, (unsigned char *)msg, msglen, &numbytes))) goto end; ossl_quic_tserver_tick(qtserv); diff --git a/test/quicfaultstest.c b/test/quicfaultstest.c index beb3e4dc41..fbbbad4dd6 100644 --- a/test/quicfaultstest.c +++ b/test/quicfaultstest.c @@ -45,7 +45,7 @@ static int test_basic(void) goto err; ossl_quic_tserver_tick(qtserv); - if (!TEST_true(ossl_quic_tserver_read(qtserv, buf, sizeof(buf), &bytesread))) + if (!TEST_true(ossl_quic_tserver_read(qtserv, 0, buf, sizeof(buf), &bytesread))) goto err; /* @@ -119,7 +119,7 @@ static int test_unknown_frame(void) NULL))) goto err; - if (!TEST_true(ossl_quic_tserver_write(qtserv, (unsigned char *)msg, msglen, + if (!TEST_true(ossl_quic_tserver_write(qtserv, 0, (unsigned char *)msg, msglen, &byteswritten))) goto err; @@ -294,7 +294,7 @@ static int test_corrupted_data(int idx) * Send first 5 bytes of message. This will get corrupted and is treated as * "lost" */ - if (!TEST_true(ossl_quic_tserver_write(qtserv, (unsigned char *)msg, 5, + if (!TEST_true(ossl_quic_tserver_write(qtserv, 0, (unsigned char *)msg, 5, &byteswritten))) goto err; @@ -317,7 +317,7 @@ static int test_corrupted_data(int idx) OSSL_sleep(100); /* Send rest of message */ - if (!TEST_true(ossl_quic_tserver_write(qtserv, (unsigned char *)msg + 5, + if (!TEST_true(ossl_quic_tserver_write(qtserv, 0, (unsigned char *)msg + 5, msglen - 5, &byteswritten))) goto err; |