summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-10-31 16:47:55 +0000
committerHugo Landau <hlandau@openssl.org>2023-11-02 08:49:28 +0000
commitd6b7545b60e72a11894a9fc043325256495473cf (patch)
tree1f06ce53be5e92ef5ba8c098af367d20998fad11 /test
parent21f1c2d9d513010f3585d5215b373ac4bef67c29 (diff)
QUIC SSTREAM: Fix bug in ossl_quic_sstream_is_totally_acked
ossl_quic_sstream_is_totally_acked would return 0 if no data had been appended to the stream yet. Fixed and added tests. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22580) (cherry picked from commit 115ee28263c28c78a34ce4e40a9e4be8361deee6)
Diffstat (limited to 'test')
-rw-r--r--test/quic_stream_test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/quic_stream_test.c b/test/quic_stream_test.c
index c80a4bf049..e2935be0d5 100644
--- a/test/quic_stream_test.c
+++ b/test/quic_stream_test.c
@@ -48,6 +48,10 @@ static int test_sstream_simple(void)
if (!TEST_ptr(sstream = ossl_quic_sstream_new(init_size)))
goto err;
+ /* A stream with nothing yet appended is totally acked */
+ if (!TEST_true(ossl_quic_sstream_is_totally_acked(sstream)))
+ goto err;
+
/* Should not have any data yet */
num_iov = OSSL_NELEM(iov);
if (!TEST_false(ossl_quic_sstream_get_stream_frame(sstream, 0, &hdr, iov,
@@ -60,6 +64,10 @@ static int test_sstream_simple(void)
|| !TEST_size_t_eq(wr, sizeof(data_1)))
goto err;
+ /* No longer totally acked */
+ if (!TEST_false(ossl_quic_sstream_is_totally_acked(sstream)))
+ goto err;
+
/* Read data */
num_iov = OSSL_NELEM(iov);
if (!TEST_true(ossl_quic_sstream_get_stream_frame(sstream, 0, &hdr, iov,
@@ -196,6 +204,9 @@ static int test_sstream_simple(void)
if (!TEST_true(ossl_quic_sstream_mark_acked_fin(sstream)))
goto err;
+ if (!TEST_true(ossl_quic_sstream_is_totally_acked(sstream)))
+ goto err;
+
testresult = 1;
err:
ossl_quic_sstream_free(sstream);