Commit b223c2a908 for openssl.org
commit b223c2a9086524a8f99a3ad06615a2e0e863c4b3
Author: Andrew Dinh <andrewd@openssl.org>
Date: Sat Sep 5 09:35:15 2026 -0400
Port script_60
Assisted-by: Claude:claude-sonnet-5
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Merge-date: Tue Sep 15 09:39:46 2026
Merged-from: https://github.com/openssl/openssl/pull/32734
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index 4039d58b30..51b1e98126 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2532,45 +2532,8 @@ static const struct script_op script_59[] = {
};
/* 60. Connection close reason truncation */
-static char long_reason[2048];
-
-static int init_reason(struct helper *h, struct helper_local *hl)
-{
- memset(long_reason, '~', sizeof(long_reason));
- memcpy(long_reason, "This is a long reason string.", 29);
- long_reason[OSSL_NELEM(long_reason) - 1] = '\0';
- return 1;
-}
-
-static int check_shutdown_reason(struct helper *h, struct helper_local *hl)
-{
- const QUIC_TERMINATE_CAUSE *tc = ossl_quic_tserver_get_terminate_cause(ACQUIRE_S());
-
- if (tc == NULL) {
- h->check_spin_again = 1;
- return 0;
- }
-
- if (!TEST_size_t_ge(tc->reason_len, 50)
- || !TEST_mem_eq(long_reason, tc->reason_len,
- tc->reason, tc->reason_len))
- return 0;
-
- return 1;
-}
-
static const struct script_op script_60[] = {
- OP_C_SET_ALPN("ossltest"),
- OP_C_CONNECT_WAIT(),
-
- OP_C_WRITE(DEFAULT, "apple", 5),
- OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
- OP_S_READ_EXPECT(a, "apple", 5),
-
- OP_CHECK(init_reason, 0),
- OP_C_SHUTDOWN_WAIT(long_reason, 0),
- OP_CHECK(check_shutdown_reason, 0),
-
+ /* test moved to test/radix/quic_tests.c */
OP_END
};
diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index 7791d9c28a..322f75fc4c 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -3531,8 +3531,56 @@ DEF_SCRIPT(script_59, "Fault injection - multi-byte frame encoding")
OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_PROTOCOL_VIOLATION, 0, 0);
}
-DEF_SCRIPT(script_60, "place holder for multistrem script_60")
+/* 60. Connection close reason truncation */
+static char long_reason_60[2048];
+
+DEF_FUNC(init_reason_60)
+{
+ memset(long_reason_60, '~', sizeof(long_reason_60));
+ memcpy(long_reason_60, "This is a long reason string.", 29);
+ long_reason_60[OSSL_NELEM(long_reason_60) - 1] = '\0';
+ return 1;
+}
+
+DEF_FUNC(check_shutdown_reason_60)
+{
+ int ok = 0;
+ SSL *ssl;
+ QUIC_CHANNEL *ch;
+ const QUIC_TERMINATE_CAUSE *tc;
+
+ REQUIRE_SSL(ssl);
+ ch = ossl_quic_conn_get_channel(ssl);
+ if (!TEST_ptr(ch))
+ goto err;
+
+ tc = ossl_quic_channel_get_terminate_cause(ch);
+ if (tc == NULL)
+ F_SPIN_AGAIN();
+
+ if (!TEST_size_t_ge(tc->reason_len, 50)
+ || !TEST_mem_eq(long_reason_60, tc->reason_len,
+ tc->reason, tc->reason_len))
+ goto err;
+
+ ok = 1;
+err:
+ return ok;
+}
+
+DEF_SCRIPT(script_60, "Connection close reason truncation")
{
+ OP_SIMPLE_PAIR_CONN();
+ OP_ACCEPT_CONN_WAIT(L, S, 0);
+
+ OP_WRITE(C, "apple", 5);
+ OP_ACCEPT_STREAM_WAIT(S, Sa, 0);
+ OP_READ_EXPECT(Sa, "apple", 5);
+
+ OP_FUNC(init_reason_60);
+ OP_SHUTDOWN_WAIT(C, 0, 0, long_reason_60);
+ OP_SELECT_SSL(0, S);
+ OP_FUNC(check_shutdown_reason_60);
}
DEF_SCRIPT(script_61, "place holder for multistrem script_61")