X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fnntpd-tls.t;h=0714631dcb1cc001d8da4774e0a4af275f352795;hb=6ebcec3add4d6aeff6e3b3eb019a404528c079ec;hp=5d170b785fcf0938b1eb6ed0c3a2e0455ef95f60;hpb=e05912ae3899a0f50a6baf3b6c1892789d24f6b1;p=public-inbox.git
diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t
index 5d170b78..0714631d 100644
--- a/t/nntpd-tls.t
+++ b/t/nntpd-tls.t
@@ -1,16 +1,13 @@
-# Copyright (C) 2019 all contributors
+# Copyright (C) 2019-2020 all contributors
# License: AGPL-3.0+
use strict;
use warnings;
use Test::More;
-use File::Temp qw(tempdir);
use Socket qw(SOCK_STREAM IPPROTO_TCP SOL_SOCKET);
+use PublicInbox::TestCommon;
# IO::Poll and Net::NNTP are part of the standard library, but
# distros may split them off...
-foreach my $mod (qw(DBD::SQLite IO::Socket::SSL Net::NNTP IO::Poll)) {
- eval "require $mod";
- plan skip_all => "$mod missing for $0" if $@;
-}
+require_mods(qw(DBD::SQLite IO::Socket::SSL Net::NNTP IO::Poll));
Net::NNTP->can('starttls') or
plan skip_all => 'Net::NNTP does not support TLS';
IO::Socket::SSL->VERSION(2.007) or
@@ -25,16 +22,15 @@ unless (-r $key && -r $cert) {
use_ok 'PublicInbox::TLS';
use_ok 'IO::Socket::SSL';
-require './t/common.perl';
require PublicInbox::InboxWritable;
require PublicInbox::MIME;
require PublicInbox::SearchIdx;
-my $need_zlib;
+our $need_zlib;
eval { require Compress::Raw::Zlib } or
$need_zlib = 'Compress::Raw::Zlib missing';
my $version = 2; # v2 needs newer git
require_git('2.6') if $version >= 2;
-my $tmpdir = tempdir('pi-nntpd-tls-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($tmpdir, $for_destroy) = tmpdir();
my $err = "$tmpdir/stderr.log";
my $out = "$tmpdir/stdout.log";
my $inboxdir = "$tmpdir";
@@ -178,7 +174,7 @@ for my $args (
SKIP: {
skip 'TCP_DEFER_ACCEPT is Linux-only', 2 if $^O ne 'linux';
- my $var = Socket::TCP_DEFER_ACCEPT();
+ my $var = eval { Socket::TCP_DEFER_ACCEPT() } // 9;
defined(my $x = getsockopt($nntps, IPPROTO_TCP, $var)) or die;
ok(unpack('i', $x) > 0, 'TCP_DEFER_ACCEPT set on NNTPS');
defined($x = getsockopt($starttls, IPPROTO_TCP, $var)) or die;