[PATCH 1/2] test/raw: add some messages likely to be multiples of buffer size
David Bremner
david at tethera.net
Sat May 4 17:10:26 PDT 2019
This highlights a bug where zero bytes are read at the end of the
file, and we attempt to write those to stdout, causing spurious write
failures.
---
test/T210-raw.sh | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/test/T210-raw.sh b/test/T210-raw.sh
index 99fdef72..0d57deb5 100755
--- a/test/T210-raw.sh
+++ b/test/T210-raw.sh
@@ -30,4 +30,39 @@ Date: GENERATED_DATE
This is just a test message (#2)"
+test_python <<EOF
+from email.message import EmailMessage
+for pow in range(12,21):
+ size = 2**pow
+ msg=EmailMessage()
+ msg['Subject'] = 'message with {:07d} bytes'.format(size)
+ msg['From'] = 'Notmuch Test Suite <test_suite at notmuchmail.org>'
+ msg['To'] = msg['From']
+ msg['Message-Id'] = 'size-{0:07d}@notmuch-test-suite'.format(size)
+ content=""
+ msg.set_content("")
+ padding = size - len(bytes(msg))
+ lines = []
+ while padding > 0:
+ line = '.' * min(padding, 72)
+ lines.append(line)
+ padding = padding - len(line) - 1
+ content ='\n'.join(lines)
+ msg.set_content(content)
+ with open('mail/size-{0:07d}'.format(size),'wb') as f:
+ f.write(bytes(msg))
+EOF
+
+notmuch new --quiet
+
+for pow in $(seq 12 20); do
+ size=$(printf "%07d" $((2**$pow)))
+ test_begin_subtest "content, message of size $size"
+ notmuch show --format=raw subject:$size > OUTPUT
+ test_expect_equal_file mail/size-$size OUTPUT
+ test_begin_subtest "return value, message of size $size"
+ test_subtest_known_broken
+ test_expect_success "notmuch show --format=raw subject:$size > /dev/null"
+done
+
test_done
--
2.20.1
More information about the notmuch
mailing list