diff options
author | Eric Wong <e@80x24.org> | 2022-02-27 11:17:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-03-01 03:48:12 +0000 |
commit | 798bd392d273735a69f0b009e70d8bb2dbc4a7e4 (patch) | |
tree | a3a4107bdf28406249e040f9ed2c9b06eccfd388 /t | |
parent | 47ab29704c99b8eab15aec885ce704b25f960023 (diff) | |
download | public-inbox-798bd392d273735a69f0b009e70d8bb2dbc4a7e4.tar.gz |
Tests run under systemd (and similar) have SIGPIPE blocked by default. This was causing this SIGPIPE test to get stuck when run by automated builders used by Nix. Thanks to Julien Moutinho and Dominique Martinet for tracking down this failure. Reported-by: Julien Moutinho <julm+public-inbox@sourcephile.fr> Reported-by: Dominique Martinet <asmadeus@codewreck.org> Link: https://public-inbox.org/meta/20220227080422.gyqowrxomzu6gyin@sourcephile.fr/
Diffstat (limited to 't')
-rw-r--r-- | t/lei-sigpipe.t | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t index 6b2772a6..7fab9aeb 100644 --- a/t/lei-sigpipe.t +++ b/t/lei-sigpipe.t @@ -1,10 +1,25 @@ #!perl -w -# Copyright (C) 2021 all contributors <meta@public-inbox.org> +# Copyright (C) all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> use strict; use v5.10.1; use PublicInbox::TestCommon; -use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE); +use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE SIG_UNBLOCK SIG_SETMASK sigprocmask); +use PublicInbox::OnDestroy; + +# undo systemd (and similar) blocking SIGPIPE, since lei expects to be run +# from an interactive terminal: +# https://public-inbox.org/meta/20220227080422.gyqowrxomzu6gyin@sourcephile.fr/ +my $set = POSIX::SigSet->new; +my $old = POSIX::SigSet->new; +$set->emptyset or xbail "sigemptyset $!"; +$old->emptyset or xbail "sigemptyset $!"; +$set->addset(SIGPIPE); +sigprocmask(SIG_UNBLOCK, $set, $old) or xbail "SIG_UNBLOCK: $!"; +my $cleanup = PublicInbox::OnDestroy->new($$, sub { + sigprocmask(SIG_SETMASK, $old); +}); + test_lei(sub { my $f = "$ENV{HOME}/big.eml"; my $imported; |