]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
t/nntpd-tls: avoid test failure on OpenBSD 7.3
authorEric Wong <e@80x24.org>
Mon, 27 Nov 2023 07:26:28 +0000 (07:26 +0000)
committerEric Wong <e@80x24.org>
Mon, 27 Nov 2023 19:43:29 +0000 (19:43 +0000)
The LibreSSL 3.7.2 on my OpenBSD 7.3 VM seems return 7 bytes of
junk data before EOF/ECONNRESET when a client attempts to write
plain-text to a TLS socket.

Tested-by: Štěpán Němec <stepnem@smrk.net>
t/nntpd-tls.t

index a11a0dd9b8abecf5934d011bd918c81d258a1bcb..a16cc015efc1d6e15aee75cfd19f8e379e34b450 100644 (file)
@@ -187,8 +187,12 @@ for my $args (
 
        my $s = tcp_connect($nntps);
        syswrite($s, '->accept_SSL_ will fail on this!');
-       ok(!sysread($s, my $rbuf, 128), 'EOF or ECONNRESET on ->accept_SSL fail');
-
+       my @r;
+       do { # some platforms or OpenSSL versions need an extra read
+               push @r, sysread($s, my $rbuf, 128);
+       } while ($r[-1] && @r < 2);
+       ok(!$r[-1], 'EOF or ECONNRESET on ->accept_SSL fail') or
+               diag explain(\@r);
        $c = undef;
        $td->kill;
        $td->join;