]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
t/lei-sigpipe.t: use correct pipe size
authorAlyssa Ross <hi@alyssa.is>
Tue, 7 Jan 2025 17:46:23 +0000 (18:46 +0100)
committerEric Wong <e@80x24.org>
Tue, 7 Jan 2025 22:32:45 +0000 (22:32 +0000)
According to fcntl(2), Linux will round up pipe sizes lower than a
page to a whole page.  Additionally, the kernel may use a larger size
in general, "if that is convenient for the implementation".  The
actual size of the pipe is returned from fcntl, so the test should use
that return value, rather than assuming the size requested was
accepted exactly.  This fixes the test on my system with 16K pages.

t/lei-sigpipe.t

index b9fd88a672ee54b721b3c277351dd5b83afdd8ae..c01d9f8362feaa35b28362083a5ef68c68c2dc2f 100644 (file)
@@ -33,8 +33,8 @@ test_lei(sub {
        my $imported;
        for my $out ([], [qw(-f mboxcl2)], [qw(-f text)]) {
                pipe(my $r, my $w);
-               my $size = $F_SETPIPE_SZ && fcntl($w, $F_SETPIPE_SZ, 4096) ?
-                       4096 : 65536;
+               my $size = ($F_SETPIPE_SZ && fcntl($w, $F_SETPIPE_SZ, 4096)) ||
+                   65536;
                unless (-f $f) {
                        my $fh = write_file '>', $f, <<'EOM';
 From: big@example.com