diff options
Diffstat (limited to 'xt/mem-imapd-tls.t')
-rw-r--r-- | xt/mem-imapd-tls.t | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/xt/mem-imapd-tls.t b/xt/mem-imapd-tls.t index 75f2911f..53adb11b 100644 --- a/xt/mem-imapd-tls.t +++ b/xt/mem-imapd-tls.t @@ -6,8 +6,8 @@ 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::Syscall qw(:epoll); use PublicInbox::DS; require_mods(qw(-imapd)); my $inboxdir = $ENV{GIANT_INBOX_DIR}; @@ -72,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; @@ -81,8 +81,8 @@ sub once { 0 }; # stops event loop # setup the event loop so that it exits at every step # while we're still doing connect(2) -PublicInbox::DS->SetLoopTimeout(0); -PublicInbox::DS->SetPostLoopCallback(\&once); +$PublicInbox::DS::loop_timeout = 0; +local @PublicInbox::DS::post_loop_do = (\&once); my $pid = $td->{pid}; if ($^O eq 'linux' && open(my $f, '<', "/proc/$pid/status")) { diag(grep(/RssAnon/, <$f>)); @@ -100,30 +100,30 @@ foreach my $n (1..$nfd) { # try not to overflow the listen() backlog: if (!($n % 128) && $DONE != $n) { diag("nr: ($n) $DONE/$nfd"); - PublicInbox::DS->SetLoopTimeout(-1); - PublicInbox::DS->SetPostLoopCallback(sub { $DONE != $n }); + $PublicInbox::DS::loop_timeout = -1; + local @PublicInbox::DS::post_loop_do = (sub { $DONE != $n }); # clear the backlog: PublicInbox::DS::event_loop(); # resume looping - PublicInbox::DS->SetLoopTimeout(0); - PublicInbox::DS->SetPostLoopCallback(\&once); + $PublicInbox::DS::loop_timeout = 0; } } # run the event loop normally, now: diag "done?: @".time." $DONE/$nfd"; if ($DONE != $nfd) { - PublicInbox::DS->SetLoopTimeout(-1); - PublicInbox::DS->SetPostLoopCallback(sub { $DONE != $nfd }); + $PublicInbox::DS::loop_timeout = -1; + local @PublicInbox::DS::post_loop_do = (sub { $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; @@ -135,7 +135,7 @@ package IMAPC; use strict; use parent qw(PublicInbox::DS); # fields: step: state machine, zin: Zlib inflate context -use PublicInbox::Syscall qw(EPOLLIN EPOLLOUT EPOLLONESHOT); +use PublicInbox::Syscall qw(EPOLLOUT EPOLLONESHOT); use Errno qw(EAGAIN); # determines where we start event_step use constant FIRST_STEP => ($ENV{TEST_COMPRESS} // 1) ? -2 : 0; |