From 70b46c9e778702ee9ca51e25ff79764745a61857 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 17 Oct 2023 23:38:10 +0000 Subject: xt/mem-imapd-tls: reduce FDs for lsof use We need some pipes in our parent process to capture the output of lsof(1), so give us some more padding for temporary FDs. --- xt/mem-imapd-tls.t | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xt') diff --git a/xt/mem-imapd-tls.t b/xt/mem-imapd-tls.t index bb2f6c35..53adb11b 100644 --- a/xt/mem-imapd-tls.t +++ b/xt/mem-imapd-tls.t @@ -6,6 +6,7 @@ use strict; use v5.10.1; use Socket qw(SOCK_STREAM IPPROTO_TCP SOL_SOCKET); +use PublicInbox::Spawn qw(which); use PublicInbox::TestCommon; use PublicInbox::DS; require_mods(qw(-imapd)); @@ -71,7 +72,7 @@ if ($TEST_TLS) { $ssl_opt{SSL_startHandshake} = 0; } chomp(my $nfd = `/bin/sh -c 'ulimit -n'`); -$nfd -= 10; +$nfd -= 20; ok($nfd > 0, 'positive FD count'); my $MAX_FD = 10000; $nfd = $MAX_FD if $nfd >= $MAX_FD; @@ -118,10 +119,11 @@ if ($DONE != $nfd) { PublicInbox::DS::event_loop(); } is($nfd, $DONE, "$nfd/$DONE done"); -if ($^O eq 'linux' && open(my $f, '<', "/proc/$pid/status")) { +my $lsof = which('lsof'); +if ($^O eq 'linux' && $lsof && open(my $f, '<', "/proc/$pid/status")) { diag(grep(/RssAnon/, <$f>)); - diag " SELF lsof | wc -l ".`lsof -p $$ |wc -l`; - diag "SERVER lsof | wc -l ".`lsof -p $pid |wc -l`; + diag " SELF lsof | wc -l ".`$lsof -p $$ |wc -l`; + diag "SERVER lsof | wc -l ".`$lsof -p $pid |wc -l`; } PublicInbox::DS->Reset; $td->kill; -- cgit v1.2.3-24-ge0c7