diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 9d2bbe8e47..4d73a75bd0 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -181,6 +181,7 @@ struct script_op { #define OPK_C_SKIP_IF_UNBOUND 48 #define OPK_S_SET_INJECT_DATAGRAM 49 #define OPK_S_SHUTDOWN 50 +#define OPK_C_STREAM_RESET_FAIL 54 #define EXPECT_CONN_CLOSE_APP (1U << 0) #define EXPECT_CONN_CLOSE_REMOTE (1U << 1) @@ -279,6 +280,8 @@ struct script_op { {OPK_S_READ_FAIL, NULL, 0, NULL, #stream_name}, #define OP_C_STREAM_RESET(stream_name, aec) \ {OPK_C_STREAM_RESET, NULL, 0, NULL, #stream_name, (aec)}, +#define OP_C_STREAM_RESET_FAIL(stream_name, aec) \ + {OPK_C_STREAM_RESET_FAIL, NULL, 0, NULL, #stream_name, (aec)}, #define OP_S_ACCEPT_STREAM_WAIT(stream_name) \ {OPK_S_ACCEPT_STREAM_WAIT, NULL, 0, NULL, #stream_name}, #define OP_NEW_THREAD(num_threads, script) \ @@ -1779,6 +1782,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script, break; case OPK_C_STREAM_RESET: + case OPK_C_STREAM_RESET_FAIL: { SSL_STREAM_RESET_ARGS args = {0}; @@ -1786,9 +1790,13 @@ static int run_script_worker(struct helper *h, const struct script_op *script, goto out; args.quic_error_code = op->arg2; - - if (!TEST_true(SSL_stream_reset(c_tgt, &args, sizeof(args)))) - goto out; + if (op->op == OPK_C_STREAM_RESET) { + if (!TEST_true(SSL_stream_reset(c_tgt, &args, sizeof(args)))) + goto out; + } else { + if (!TEST_false(SSL_stream_reset(c_tgt, &args, sizeof(args)))) + goto out; + } } break; @@ -5163,6 +5171,26 @@ static const struct script_op script_79[] = { OP_END }; + +/* 87. Test stream reset functionality */ +static const struct script_op script_87[] = { + OP_C_SET_ALPN ("ossltest") + OP_C_CONNECT_WAIT () + OP_C_NEW_STREAM_BIDI (a, C_BIDI_ID(0)) + OP_C_WRITE (a, "apple", 5) + OP_C_CONCLUDE (a) + OP_S_BIND_STREAM_ID (a, C_BIDI_ID(0)) + OP_S_READ_EXPECT (a, "apple", 5) + OP_S_EXPECT_FIN (a) + OP_S_WRITE (a, "orange", 6) + OP_C_READ_EXPECT (a, "orange", 6) + OP_S_CONCLUDE (a) + OP_C_EXPECT_FIN (a) + OP_SLEEP (1000) + OP_C_STREAM_RESET_FAIL (a, 42) + OP_END +}; + static const struct script_op *const scripts[] = { script_1, script_2, @@ -5243,6 +5271,7 @@ static const struct script_op *const scripts[] = { script_77, script_78, script_79, + script_87 }; static int test_script(int idx)