summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2024-02-14 09:09:54 +0000
committerHugo Landau <hlandau@openssl.org>2024-03-09 08:56:59 +0000
commit7b4436a7cb23bd9ee2736336f40d2f2834c4965a (patch)
treeaa825dc5adcd0b1234ede6949d58b9afb519cd59 /test
parentb317583f4ad8a8e742781381fa10db5bcd072585 (diff)
QUIC MULTISTREAM TEST: Test write buffer statistics queries
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23584)
Diffstat (limited to 'test')
-rw-r--r--test/quic_multistream_test.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index 26025fb889..7c2e1a3d74 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -5389,6 +5389,31 @@ static int check_avail_streams(struct helper *h, struct helper_local *hl)
return 1;
}
+static int set_event_handling_mode_conn(struct helper *h, struct helper_local *hl);
+static int reenable_test_event_handling(struct helper *h, struct helper_local *hl);
+
+static int check_write_buf_stat(struct helper *h, struct helper_local *hl)
+{
+ SSL *c_a;
+ uint64_t size, used, avail;
+
+ if (!TEST_ptr(c_a = helper_local_get_c_stream(hl, "a")))
+ return 0;
+
+ if (!TEST_true(SSL_get_stream_write_buf_size(c_a, &size))
+ || !TEST_true(SSL_get_stream_write_buf_used(c_a, &used))
+ || !TEST_true(SSL_get_stream_write_buf_avail(c_a, &avail))
+ || !TEST_uint64_t_ge(size, avail)
+ || !TEST_uint64_t_ge(size, used)
+ || !TEST_uint64_t_eq(avail + used, size))
+ return 0;
+
+ if (!TEST_uint64_t_eq(used, hl->check_op->arg1))
+ return 0;
+
+ return 1;
+}
+
static const struct script_op script_84[] = {
OP_C_SET_ALPN ("ossltest")
OP_C_CONNECT_WAIT ()
@@ -5436,6 +5461,20 @@ static const struct script_op script_84[] = {
OP_CHECK2 (check_avail_streams, 2, 99)
OP_CHECK2 (check_avail_streams, 3, 99)
+ OP_CHECK2 (check_write_buf_stat, 0, 0)
+ OP_CHECK (set_event_handling_mode_conn,
+ SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT)
+ OP_C_WRITE (a, "apple", 5)
+ OP_CHECK2 (check_write_buf_stat, 5, 0)
+
+ OP_CHECK (reenable_test_event_handling, 0)
+
+ OP_S_BIND_STREAM_ID (a, C_BIDI_ID(0))
+ OP_S_READ_EXPECT (a, "apple", 5)
+ OP_S_WRITE (a, "orange", 6)
+ OP_C_READ_EXPECT (a, "orange", 6)
+ OP_CHECK2 (check_write_buf_stat, 0, 0)
+
OP_END
};