Commit 6bb3799400 for openssl.org
commit 6bb3799400f75258e8bbf371ee594605b0896c4e
Author: Andrew Dinh <andrewd@openssl.org>
Date: Wed Jun 24 22:59:43 2026 +0700
Port script_5
Also fixes a bug in the OP_STREAM_RESET macro
Assisted-by: Claude:claude-sonnet-4-6
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:46 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index 4edd53e15f..38289e6892 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -373,18 +373,6 @@ static void s_unlock(struct helper *h, struct helper_local *hl);
#define ACQUIRE_S() s_lock(h, hl)
#define ACQUIRE_S_NOHL() s_lock(h, NULL)
-static int check_stream_reset(struct helper *h, struct helper_local *hl)
-{
- uint64_t stream_id = hl->check_op->arg2, aec = 0;
-
- if (!ossl_quic_tserver_stream_has_peer_reset_stream(ACQUIRE_S(), stream_id, &aec)) {
- h->check_spin_again = 1;
- return 0;
- }
-
- return TEST_uint64_t_eq(aec, 42);
-}
-
static int check_stream_stopped(struct helper *h, struct helper_local *hl)
{
uint64_t stream_id = hl->check_op->arg2;
@@ -2063,25 +2051,7 @@ static const struct script_op script_4[] = {
/* 5. Test stream reset functionality */
static const struct script_op script_5[] = {
- OP_C_SET_ALPN("ossltest"),
- OP_C_CONNECT_WAIT(),
-
- OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE),
- OP_C_NEW_STREAM_BIDI(a, C_BIDI_ID(0)),
- OP_C_NEW_STREAM_BIDI(b, C_BIDI_ID(1)),
-
- OP_C_WRITE(a, "apple", 5),
- OP_C_STREAM_RESET(a, 42),
-
- OP_C_WRITE(b, "strawberry", 10),
-
- OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
- OP_S_BIND_STREAM_ID(b, C_BIDI_ID(1)),
- OP_S_READ_EXPECT(b, "strawberry", 10),
- /* Reset disrupts read of already sent data */
- OP_S_READ_FAIL(a, 0),
- OP_CHECK(check_stream_reset, C_BIDI_ID(0)),
-
+ /* test moved to test/radix/quic_tests.c */
OP_END
};
diff --git a/test/radix/quic_ops.c b/test/radix/quic_ops.c
index 11cf93be30..27e5a3705d 100644
--- a/test/radix/quic_ops.c
+++ b/test/radix/quic_ops.c
@@ -1099,7 +1099,7 @@ err:
#define OP_STREAM_RESET(name, error_code) \
(OP_SELECT_SSL(0, name), \
- OP_PUSH_U64(flags), \
+ OP_PUSH_PZ(#name), \
OP_PUSH_U64(error_code), \
OP_FUNC(hf_stream_reset))
diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index d1d8c54949..2f778e7a26 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -765,6 +765,30 @@ DEF_SCRIPT(check_ctx_cbks, "Check new_pending and client_hello callbacks")
OP_FUNC(check_pending);
}
+DEF_FUNC(check_stream_reset_5)
+{
+ int ok = 0;
+ SSL *ssl;
+ uint64_t aec = 0;
+ int state;
+
+ REQUIRE_SSL(ssl);
+
+ state = SSL_get_stream_read_state(ssl);
+ if (state != SSL_STREAM_STATE_RESET_REMOTE)
+ F_SPIN_AGAIN();
+
+ if (!TEST_true(SSL_get_stream_read_error_code(ssl, &aec)))
+ goto err;
+
+ if (!TEST_uint64_t_eq(aec, 42))
+ goto err;
+
+ ok = 1;
+err:
+ return ok;
+}
+
/*
* script_5 - script_106 are place holders for tests we
* currently keep in test/quic_multistream_test.c.
@@ -778,8 +802,29 @@ DEF_SCRIPT(check_ctx_cbks, "Check new_pending and client_hello callbacks")
* The scaffolding here hopes to avoid conflicts in 'scripts'
* array below when more PRs will be in flight.
*/
-DEF_SCRIPT(script_5, "place holder for multistram script_5")
+
+/* 5. Test stream reset functionality */
+DEF_SCRIPT(script_5, "Test stream reset functionality")
{
+ OP_SIMPLE_PAIR_CONN_ND();
+
+ OP_NEW_STREAM(C, Ca, 0 /* bidirectional */);
+ OP_NEW_STREAM(C, Cb, 0 /* bidirectional */);
+
+ OP_WRITE(Ca, "apple", 5);
+ OP_STREAM_RESET(Ca, 42);
+
+ OP_WRITE(Cb, "strawberry", 10);
+
+ OP_ACCEPT_CONN_WAIT_ND(L, S, 0);
+ OP_ACCEPT_STREAM_WAIT(S, Sa, 0); /* first stream = Ca */
+ OP_ACCEPT_STREAM_WAIT(S, Sb, 0); /* second stream = Cb */
+
+ /* Reset disrupts read of already-sent data */
+ OP_SELECT_SSL(0, Sa);
+ OP_FUNC(check_stream_reset_5);
+
+ OP_READ_EXPECT(Sb, "strawberry", 10);
}
DEF_SCRIPT(script_6, "place holder for multistram script_6")