From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 1/2] xt/mem-msgview.t: change to test one multipart message
Date: Sat, 11 Jan 2020 06:28:15 +0000 [thread overview]
Message-ID: <20200111062816.9891-2-e@yhbt.net> (raw)
In-Reply-To: <20200111062816.9891-1-e@yhbt.net>
A single multipart message is far more common than
a reused Message-ID, so rewrite the test to only have
a single multipart message. Memory improvements will
be implemented in the next commit.
---
xt/mem-msgview.t | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/xt/mem-msgview.t b/xt/mem-msgview.t
index 1ea0f559..68b5919f 100644
--- a/xt/mem-msgview.t
+++ b/xt/mem-msgview.t
@@ -1,6 +1,8 @@
#!perl -w
# Copyright (C) 2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+# Note: this may be altered as-needed to demonstrate improvements.
+# See history in git for this file.
use strict;
use IO::Handle; # ->flush
use Fcntl qw(SEEK_SET);
@@ -11,7 +13,7 @@ use Test::More;
my @mods = qw(DBD::SQLite BSD::Resource);
require_mods(@mods);
use_ok($_) for @mods;
-my $lines = $ENV{NR_LINES} // 100000;
+my $lines = $ENV{NR_LINES} // 50000;
my ($tmpdir, $for_destroy) = tmpdir();
my $inboxname = 'big';
my $inboxdir = "$tmpdir/big";
@@ -32,29 +34,39 @@ EOF
'inbox initialized');
$fh = tmpfile('big.eml', undef, my $append = 1) or die;
- printf($fh <<'EOF', $addr, $mid) or die;
+ my $hdr = sprintf(<<'EOF', $addr, $mid);
From: Dr. X <x@example.com>
To: Nikki <%s>
Date: Tue, 3 May 1988 00:00:00 +0000
Subject: todo
Message-ID: <%s>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="FOO"
+Content-Disposition: inline
+
+--FOO
+Content-Type: text/plain; charset=utf-8
+Content-Disposition: inline
+
+EOF
+ print $fh $hdr or die;
+ for (0..$lines) { print $fh 'x' x 72, "\n" or die }
+ print $fh <<EOF or die;
+
+--FOO
+Content-Type: text/plain; charset=utf-8
+Content-Disposition: inline
EOF
for (0..$lines) { print $fh 'x' x 72, "\n" or die }
+ print $fh "\n--FOO--\n" or die;
$fh->flush or die;
sysseek($fh, 0, SEEK_SET) or die;
my $env = { ORIGINAL_RECIPIENT => $addr };
my $err = '';
my $opt = { 0 => $fh, 2 => \$err, run_mode => 0 };
ok(run_script([qw(-mda --no-precheck)], $env, $opt),
- '1st message delivered');
-
- # resend the message with same mid but different content
- print $fh "mindcrime\n" or die;
- $fh->flush or die;
- sysseek($fh, 0, SEEK_SET) or die;
- ok(run_script([qw(-mda --no-precheck)], $env, $opt),
- '2nd message delivered');
+ 'message delivered');
}
my $www = PublicInbox::WWW->new;
next prev parent reply other threads:[~2020-01-11 6:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-11 6:28 [PATCH 0/2] www: memory reductions for multipart Eric Wong
2020-01-11 6:28 ` Eric Wong [this message]
2020-01-11 6:28 ` [PATCH 2/2] www: discard multipart parent on iteration Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200111062816.9891-2-e@yhbt.net \
--to=e@yhbt.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).