From: Eric Wong Date: Wed, 21 Sep 2022 17:02:54 +0000 (+0000) Subject: t/pop3d: skip all tests if no certs are found X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=fbe89926961e2e090481fa283048c31aaddc17cf t/pop3d: skip all tests if no certs are found This test could be written with optional OpenSSL dependencies, but it's probably not worth it since IO::Socket::SSL seems pretty common. Reported-by: Uwe Kleine-König Link: https://public-inbox.org/meta/20220921154741.siubptwcv4463w5l@pengutronix.de/ --- diff --git a/t/pop3d.t b/t/pop3d.t index 7248c03f..dc52b0cf 100644 --- a/t/pop3d.t +++ b/t/pop3d.t @@ -4,6 +4,13 @@ use v5.12; use PublicInbox::TestCommon; use Socket qw(IPPROTO_TCP SOL_SOCKET); +my $cert = 'certs/server-cert.pem'; +my $key = 'certs/server-key.pem'; +unless (-r $key && -r $cert) { + plan skip_all => + "certs/ missing for $0, run $^X ./create-certs.perl in certs/"; +} + # Net::POP3 is part of the standard library, but distros may split it off... require_mods(qw(DBD::SQLite Net::POP3 IO::Socket::SSL)); require_git('2.6'); # for v2 @@ -44,14 +51,6 @@ my $pop3s_addr = tcp_host_port($pop3s); my $stls_addr = tcp_host_port($stls); my $plain_addr = tcp_host_port($plain); my $env = { PI_CONFIG => $pi_config }; -my $cert = 'certs/server-cert.pem'; -my $key = 'certs/server-key.pem'; - -unless (-r $key && -r $cert) { - plan skip_all => - "certs/ missing for $0, run $^X ./create-certs.perl in certs/"; -} - my $old = start_script(['-pop3d', '-W0', "--stdout=$tmpdir/plain.out", "--stderr=$olderr" ], $env, { 3 => $plain });