summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-10-24 08:23:39 +0100
committerMatt Caswell <matt@openssl.org>2023-10-25 09:42:03 +0100
commit687326ce0ac56c405029cfedd435b2e6625a22e3 (patch)
treebdb583304ca6b822f2e2fde8230b891abc0cfe4c
parent55abe7486089ffa24b52e68a56b7eaed9a60a8ee (diff)
QUIC MULTISTREAM TEST: Output connection closure reason info on failure
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22485)
-rw-r--r--test/quic_multistream_test.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index 09792c2f71..25cd83db34 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -1945,6 +1945,8 @@ out:
s_unlock(h, hl); /* idempotent */
if (!testresult) {
size_t i;
+ const QUIC_TERMINATE_CAUSE *tcause;
+ const char *e_str, *f_str;
TEST_error("failed in script \"%s\" at op %zu, thread %d\n",
script_name, op_idx + 1, thread_idx);
@@ -1954,6 +1956,56 @@ out:
repeat_stack_done[i],
repeat_stack_limit[i],
repeat_stack_idx[i]);
+
+ ERR_print_errors_fp(stderr);
+
+ if (h->c_conn != NULL) {
+ SSL_CONN_CLOSE_INFO cc_info = {0};
+
+ if (SSL_get_conn_close_info(h->c_conn, &cc_info, sizeof(cc_info))) {
+ e_str = ossl_quic_err_to_string(cc_info.error_code);
+ f_str = ossl_quic_frame_type_to_string(cc_info.frame_type);
+
+ if (e_str == NULL)
+ e_str = "?";
+ if (f_str == NULL)
+ f_str = "?";
+
+ TEST_info("client side is closed: %llu(%s)/%llu(%s), "
+ "%s, %s, reason: \"%s\"",
+ (unsigned long long)cc_info.error_code,
+ e_str,
+ (unsigned long long)cc_info.frame_type,
+ f_str,
+ (cc_info.flags & SSL_CONN_CLOSE_FLAG_LOCAL) != 0
+ ? "local" : "remote",
+ (cc_info.flags & SSL_CONN_CLOSE_FLAG_TRANSPORT) != 0
+ ? "transport" : "app",
+ cc_info.reason != NULL ? cc_info.reason : "-");
+ }
+ }
+
+ tcause = (h->s != NULL
+ ? ossl_quic_tserver_get_terminate_cause(h->s) : NULL);
+ if (tcause != NULL) {
+ e_str = ossl_quic_err_to_string(tcause->error_code);
+ f_str = ossl_quic_frame_type_to_string(tcause->frame_type);
+
+ if (e_str == NULL)
+ e_str = "?";
+ if (f_str == NULL)
+ f_str = "?";
+
+ TEST_info("server side is closed: %llu(%s)/%llu(%s), "
+ "%s, %s, reason: \"%s\"",
+ (unsigned long long)tcause->error_code,
+ e_str,
+ (unsigned long long)tcause->frame_type,
+ f_str,
+ tcause->remote ? "remote" : "local",
+ tcause->app ? "app" : "transport",
+ tcause->reason != NULL ? tcause->reason : "-");
+ }
}
OPENSSL_free(tmp_buf);