From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 4E9871F464 for ; Tue, 17 Sep 2019 08:51:01 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] t/httpd-corner.t: don't fail lsof test if stdin is a pipe Date: Tue, 17 Sep 2019 08:50:59 +0000 Message-Id: <20190917085100.14785-2-e@80x24.org> In-Reply-To: <20190917085100.14785-1-e@80x24.org> References: <20190917085100.14785-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We don't want the stdin from the test runner to accidentally cause this test to fail. --- t/httpd-corner.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/httpd-corner.t b/t/httpd-corner.t index f5937e76..c6f78dde 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -31,6 +31,10 @@ my $httpd = 'blib/script/public-inbox-httpd'; my $psgi = "./t/httpd-corner.psgi"; my $sock = tcp_server(); +# make sure stdin is not a pipe for lsof test to check for leaking pipes +open(my $null, '<', '/dev/null') or die 'no /dev/null: $!'; +my $rdr = { 0 => fileno($null) }; + # Make sure we don't clobber socket options set by systemd or similar # using socket activation: my ($defer_accept_val, $accf_arg); @@ -57,7 +61,7 @@ END { kill 'TERM', $pid if defined $pid }; my $spawn_httpd = sub { my (@args) = @_; my $cmd = [ $httpd, @args, "--stdout=$out", "--stderr=$err", $psgi ]; - $pid = spawn_listener(undef, $cmd, [ $sock, $unix ]); + $pid = spawn_listener(undef, $cmd, [ $sock, $unix ], $rdr); ok(defined $pid, 'forked httpd process successfully'); };