about summary refs log tree commit homepage
path: root/t/pop3d.t
diff options
context:
space:
mode:
Diffstat (limited to 't/pop3d.t')
-rw-r--r--t/pop3d.t26
1 files changed, 11 insertions, 15 deletions
diff --git a/t/pop3d.t b/t/pop3d.t
index 7248c03f..ee19f2d7 100644
--- a/t/pop3d.t
+++ b/t/pop3d.t
@@ -4,10 +4,16 @@
 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
-require_mods(qw(File::FcntlLock)) if $^O !~ /\A(?:linux|freebsd)\z/;
+require_mods(qw(DBD::SQLite Net::POP3 IO::Socket::SSL :fcntl_lock));
+require_git(v2.6); # for v2
 use_ok 'IO::Socket::SSL';
 use_ok 'PublicInbox::TLS';
 my ($tmpdir, $for_destroy) = tmpdir();
@@ -44,14 +50,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 });
@@ -268,16 +266,14 @@ EOF
                 is(unpack('i', $x), 0, 'TCP_DEFER_ACCEPT is 0 on plain POP3');
         };
         SKIP: {
-                skip 'SO_ACCEPTFILTER is FreeBSD-only', 2 if $^O ne 'freebsd';
-                system('kldstat -m accf_data >/dev/null') and
-                        skip 'accf_data not loaded? kldload accf_data', 2;
+                require_mods '+accf_data';
                 require PublicInbox::Daemon;
                 my $x = getsockopt($pop3s, SOL_SOCKET,
                                 $PublicInbox::Daemon::SO_ACCEPTFILTER);
                 like($x, qr/\Adataready\0+\z/, 'got dataready accf for pop3s');
                 $x = getsockopt($stls, IPPROTO_TCP,
                                 $PublicInbox::Daemon::SO_ACCEPTFILTER);
-                is($x, undef, 'no BSD accept filter for plain IMAP');
+                is($x, undef, 'no BSD accept filter for plain POP3');
         };
 
         $td->kill;