From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 544901F506; Wed, 21 Sep 2022 17:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1663779774; bh=y5YiNgwMF5WpCiHjg+LDO4kcEADs3r3Ilp7DQMer1es=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WsEgd/sJ56Zom/FpEVuJeYIwiV+NLInOVagf0Z2ziuHgvuDzrV8edK6+GUTMvVJXw Zhk/LUiiY72lcLMU2vJzBsaTJ1Nw7V5Y95Urh994AEZJL8KiYRMKJU8rmrztMS0FLq f+6hF0rP5RHcS09E5kiGYCOoWNwIlM6CnyBPWG0g= Date: Wed, 21 Sep 2022 17:02:54 +0000 From: Eric Wong To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: meta@public-inbox.org Subject: [PATCH] t/pop3d: skip all tests if no certs are found Message-ID: <20220921170254.M219817@dcvr> References: <20220921154741.siubptwcv4463w5l@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220921154741.siubptwcv4463w5l@pengutronix.de> List-Id: Uwe Kleine-König wrote: > $ prove t/pop3d.t > t/pop3d.t .. skipped: certs/ missing for t/pop3d.t, run /usr/bin/perl ./create-certs.perl in certs/ > t/pop3d.t (Wstat: 0 Tests: 2 Failed: 0) > Parse errors: Bad plan. You planned 0 tests but ran 2. > It looks better after I called the create-certs script, but IMHO it > should work as is and just skip the two tests as advertised? Oops, yes, fix at bottom. > After calling the create-certs script I get: > > t/pop3d.t .. 1/? Not enough arguments for PublicInbox::Daemon::run at blib/script/public-inbox-pop3d line 8, near "'pop3://0.0.0.0:110')" > Execution of blib/script/public-inbox-pop3d aborted due to compilation errors. You need to use `prove -b' to add blib/{lib,arch} to the search path. Omitting -b means you're using the system-wide installed version. `prove -l' also works for this project for users who don't run `make' first (uses ./lib instead of blib/...) since this project has no XS. > Then it hangs. I'm not fluent enough in Perl to fix that quickly myself > and my today's time to look into public-inbox is running out, so I > thought I let you know. No worries, I should be online more the rest of the year :> --------8<------- Subject: [PATCH] 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/ --- t/pop3d.t | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 });