summaryrefslogtreecommitdiffstats
path: root/test/recipes/70-test_quic_multistream.t
blob: 7257ca09380a7fea060b149aebf594d7c970652e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /usr/bin/env perl
# Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html

use OpenSSL::Test qw/:DEFAULT srctop_file result_dir data_file/;
use OpenSSL::Test::Utils;
use File::Temp qw(tempfile);
use File::Path 2.00 qw(rmtree mkpath);

setup("test_quic_multistream");

plan skip_all => "QUIC protocol is not supported by this OpenSSL build"
    if disabled('quic');

plan tests => 3;

my $qlog_output;
if (!disabled('qlog') && $ENV{OSSL_RUN_CI_TESTS} == "1") {
    $qlog_output = result_dir("qlog-output");
    print "# Writing qlog output to $qlog_output\n";
    rmtree($qlog_output, { safe => 1 });
    mkdir($qlog_output);
    $ENV{QLOGDIR} = $qlog_output;
}

$ENV{OSSL_QFILTER} = "* -quic:unknown_event quic:another_unknown_event";

ok(run(test(["quic_multistream_test",
             srctop_file("test", "certs", "servercert.pem"),
             srctop_file("test", "certs", "serverkey.pem")])));

SKIP: {
    skip "no qlog", 1 if disabled('qlog');
    skip "not running CI tests", 1 unless $ENV{OSSL_RUN_CI_TESTS};

    subtest "check qlog output" => sub {
        plan tests => 1;

        ok(run(cmd(["python3", data_file("verify-qlog.py")])),
               "running qlog verification script");
    };
}

SKIP: {
    skip "no qlog", 1 if disabled('qlog');
    skip "not running CI tests", 1 unless $ENV{OSSL_RUN_CI_TESTS};
    skip "not running artifacts upload", 1 unless $ENV{OSSL_CI_ARTIFACTS_PATH};

    subtest "copy qlog artifacts to upload directory" => sub {
        plan tests => 1;

        my $artifacts_path = $ENV{OSSL_CI_ARTIFACTS_PATH};
        mkpath("${artifacts_path}/quic_multistream_test");
        ok(run(cmd(["mv", "--", $qlog_output,
                    "${artifacts_path}/quic_multistream_test/"])));
    };
}