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 12C7C1F463 for ; Fri, 13 Sep 2019 01:50:26 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] t/httpd-corner: check for leaking FDs and pipes Date: Fri, 13 Sep 2019 01:50:25 +0000 Message-Id: <20190913015025.17056-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: -W0 (no workers) should not create any pipes on its own, and we shouldn't have any deleted FDs if no clients are connected. This can find if leaks which may be triggered by PublicInbox::HTTP (and not Qspawn or GitHTTPBackend). --- t/httpd-corner.t | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/t/httpd-corner.t b/t/httpd-corner.t index c72bc9c6..af838628 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -526,6 +526,14 @@ SKIP: { defined(my $x = getsockopt($sock, SOL_SOCKET, $var)) or die; is($x, $accf_arg, 'SO_ACCEPTFILTER unchanged if previously set'); }; +SKIP: { + use PublicInbox::Spawn qw(which); + skip 'only testing lsof(8) output on Linux', 1 if $^O ne 'linux'; + skip 'no lsof in PATH', 1 unless which('lsof'); + my @lsof = `lsof -p $pid`; + is_deeply([grep(/\bdeleted\b/, @lsof)], [], 'no lingering deleted inputs'); + is_deeply([grep(/\bpipe\b/, @lsof)], [], 'no extra pipes with -W0'); +}; done_testing();