summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/quic_tserver_test.c21
-rw-r--r--test/recipes/70-test_quic_tserver.t8
2 files changed, 25 insertions, 4 deletions
diff --git a/test/quic_tserver_test.c b/test/quic_tserver_test.c
index 0e070cb1f2..c2a831c89c 100644
--- a/test/quic_tserver_test.c
+++ b/test/quic_tserver_test.c
@@ -18,6 +18,8 @@
static const char msg1[] = "The quick brown fox jumped over the lazy dogs.";
static char msg2[1024], msg3[1024];
+static const char *certfile, *keyfile;
+
static int is_want(SSL *s, int ret)
{
int ec = SSL_get_error(s, ret);
@@ -43,6 +45,7 @@ static int test_tserver(void)
size_t l = 0, s_total_read = 0, s_total_written = 0, c_total_read = 0;
int s_begin_write = 0;
OSSL_TIME start_time;
+ unsigned char alpn[] = { 8, 'o', 's', 's', 'l', 't', 'e', 's', 't' };
ina.s_addr = htonl(0x7f000001UL);
@@ -80,7 +83,8 @@ static int test_tserver(void)
tserver_args.net_rbio = s_net_bio;
tserver_args.net_wbio = s_net_bio;
- if (!TEST_ptr(tserver = ossl_quic_tserver_new(&tserver_args))) {
+ if (!TEST_ptr(tserver = ossl_quic_tserver_new(&tserver_args, certfile,
+ keyfile))) {
BIO_free(s_net_bio);
goto err;
}
@@ -107,6 +111,10 @@ static int test_tserver(void)
if (!TEST_ptr(c_ssl = SSL_new(c_ctx)))
goto err;
+ /* 0 is a success for SSL_set_alpn_protos() */
+ if (!TEST_false(SSL_set_alpn_protos(c_ssl, alpn, sizeof(alpn))))
+ goto err;
+
/* Takes ownership of our reference to the BIO. */
SSL_set0_rbio(c_ssl, c_net_bio);
@@ -215,8 +223,19 @@ err:
return testresult;
}
+OPT_TEST_DECLARE_USAGE("certfile privkeyfile\n")
+
int setup_tests(void)
{
+ if (!test_skip_common_options()) {
+ TEST_error("Error parsing test options\n");
+ return 0;
+ }
+
+ if (!TEST_ptr(certfile = test_get_argument(0))
+ || !TEST_ptr(keyfile = test_get_argument(1)))
+ return 0;
+
ADD_TEST(test_tserver);
return 1;
}
diff --git a/test/recipes/70-test_quic_tserver.t b/test/recipes/70-test_quic_tserver.t
index 76c24c36c5..4ff2d208b6 100644
--- a/test/recipes/70-test_quic_tserver.t
+++ b/test/recipes/70-test_quic_tserver.t
@@ -6,14 +6,16 @@
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
-use OpenSSL::Test;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
use OpenSSL::Test::Utils;
-setup("test_quic_txp");
+setup("test_quic_tserver");
plan skip_all => "QUIC protocol is not supported by this OpenSSL build"
if disabled('quic');
plan tests => 1;
-ok(run(test(["quic_tserver_test"])));
+ok(run(test(["quic_tserver_test",
+ srctop_file("test", "certs", "servercert.pem"),
+ srctop_file("test", "certs", "serverkey.pem")])));