]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/httpd-corner: check for leaking FDs and pipes
authorEric Wong <e@80x24.org>
Fri, 13 Sep 2019 01:50:25 +0000 (01:50 +0000)
committerEric Wong <e@80x24.org>
Sat, 14 Sep 2019 09:36:38 +0000 (09:36 +0000)
-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

index c72bc9c6368cc2b3f6fb2f49045cb374ffe96a56..af838628717d94ca2e70e750ca7cc3def718bda1 100644 (file)
@@ -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();