Commit bf2ab6708a for openssl.org

commit bf2ab6708a47b725acd61de4072b61a318240fad
Author: Andrew Dinh <andrewd@openssl.org>
Date:   Sat Aug 1 20:03:19 2026 +0700

    Port script_40

    Assisted-by: Claude:claude-sonnet-5

    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Reviewed-by: Bob Beck <beck@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    MergeDate: Sat Aug 15 16:49:39 2026
    (Merged from https://github.com/openssl/openssl/pull/32236)

diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index eae033b52d..728c45e2be 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2499,42 +2499,8 @@ static const struct script_op script_39[] = {
 };

 /* 40. Shutdown flush test */
-static const unsigned char script_40_data[1024] = "strawberry";
-
 static const struct script_op script_40[] = {
-    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_WRITE(a, "apple", 5),
-
-    OP_C_INHIBIT_TICK(1),
-    OP_C_SET_WRITE_BUF_SIZE(a, 1024 * 100 * 3),
-
-    OP_BEGIN_REPEAT(100),
-
-    OP_C_WRITE(a, script_40_data, sizeof(script_40_data)),
-
-    OP_END_REPEAT(),
-
-    OP_C_CONCLUDE(a),
-    OP_C_SHUTDOWN_WAIT(NULL, 0), /* disengages tick inhibition */
-
-    OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
-    OP_S_READ_EXPECT(a, "apple", 5),
-
-    OP_BEGIN_REPEAT(100),
-
-    OP_S_READ_EXPECT(a, script_40_data, sizeof(script_40_data)),
-
-    OP_END_REPEAT(),
-
-    OP_S_EXPECT_FIN(a),
-
-    OP_C_EXPECT_CONN_CLOSE_INFO(0, 1, 0),
-    OP_S_EXPECT_CONN_CLOSE_INFO(0, 1, 1),
-
+    /* 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 ce2b9db89c..de577468da 100644
--- a/test/radix/quic_ops.c
+++ b/test/radix/quic_ops.c
@@ -1467,6 +1467,56 @@ err:
     return ok;
 }

+DEF_FUNC(hf_push_stream_id_plus_one)
+{
+    int ok = 0;
+    SSL *ssl;
+    uint64_t stream_id_plus_one;
+
+    REQUIRE_SSL(ssl);
+    stream_id_plus_one = SSL_get_stream_id(ssl) + 1;
+    F_PUSH(stream_id_plus_one);
+    ok = 1;
+err:
+    return ok;
+}
+
+DEF_FUNC(hf_inhibit_tick)
+{
+    int ok = 0;
+    uint64_t inhibit;
+    SSL *ssl;
+    QUIC_CHANNEL *ch;
+
+    F_POP(inhibit);
+    REQUIRE_SSL(ssl);
+
+    ch = ossl_quic_conn_get_channel(ssl);
+    ossl_quic_engine_set_inhibit_tick(ossl_quic_channel_get0_engine(ch),
+        (int)inhibit);
+
+    ok = 1;
+err:
+    return ok;
+}
+
+DEF_FUNC(hf_set_write_buf_size)
+{
+    int ok = 0;
+    size_t size;
+    SSL *ssl;
+
+    F_POP(size);
+    REQUIRE_SSL(ssl);
+
+    if (!TEST_true(ossl_quic_set_write_buffer_size(ssl, size)))
+        goto err;
+
+    ok = 1;
+err:
+    return ok;
+}
+
 #define OP_UNBIND(name) \
     (OP_PUSH_PZ(#name), \
         OP_FUNC(hf_unbind))
@@ -1772,3 +1822,17 @@ err:
     (OP_PUSH_U64(word0),                 \
         OP_PUSH_U64(word1),              \
         OP_FUNC(hf_set_inject_word))
+
+#define OP_PUSH_STREAM_ID_PLUS_ONE(name) \
+    (OP_SELECT_SSL(0, name),             \
+        OP_FUNC(hf_push_stream_id_plus_one))
+
+#define OP_INHIBIT_TICK(name, inhibit) \
+    (OP_SELECT_SSL(0, name),           \
+        OP_PUSH_U64(inhibit),          \
+        OP_FUNC(hf_inhibit_tick))
+
+#define OP_SET_WRITE_BUF_SIZE(name, size) \
+    (OP_SELECT_SSL(0, name),              \
+        OP_PUSH_SIZE(size),               \
+        OP_FUNC(hf_set_write_buf_size))
diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index 308cf6c747..627ca3b4d5 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -2528,8 +2528,38 @@ DEF_SCRIPT(script_39, "Fault injection - NEW_CONN_ID with zero-len CID")
     OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_FRAME_ENCODING_ERROR, 0, 0);
 }

-DEF_SCRIPT(script_40, "place holder for multistrem script_40")
+/* 40. Shutdown flush test */
+static unsigned char script_40_data[1024] = "strawberry";
+
+DEF_SCRIPT(script_40, "Shutdown flush test")
 {
+    size_t i;
+
+    OP_SIMPLE_PAIR_CONN_ND();
+
+    OP_NEW_STREAM(C, Ca, 0 /* bidirectional */);
+    OP_WRITE(Ca, "apple", 5);
+
+    OP_INHIBIT_TICK(C, 1);
+    OP_SET_WRITE_BUF_SIZE(Ca, 1024 * 100 * 3);
+
+    for (i = 0; i < 100; ++i)
+        OP_WRITE(Ca, script_40_data, sizeof(script_40_data));
+
+    OP_CONCLUDE(Ca);
+    OP_SHUTDOWN_WAIT(C, 0, 0, NULL); /* disengages tick inhibition */
+
+    OP_ACCEPT_CONN_WAIT_ND(L, S, 0);
+    OP_ACCEPT_STREAM_WAIT(S, Sa, 0);
+    OP_READ_EXPECT(Sa, "apple", 5);
+
+    for (i = 0; i < 100; ++i)
+        OP_READ_EXPECT(Sa, script_40_data, sizeof(script_40_data));
+
+    OP_EXPECT_FIN(Sa);
+
+    OP_EXPECT_CONN_CLOSE_INFO(C, 0, 1, 0);
+    OP_EXPECT_CONN_CLOSE_INFO(S, 0, 1, 1);
 }

 DEF_SCRIPT(script_41, "place holder for multistrem script_41")