From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] test: increase test data sizes to fill socket buffers
Date: Fri, 16 Dec 2016 10:29:55 +0000 [thread overview]
Message-ID: <20161216102955.13495-1-e@80x24.org> (raw)
Some Debian build machines use insanely large socket
buffers, so increase our test buffers to large values to
force EAGAIN: https://bugs.debian.org/830353
In my experience, using setsockopt to clamp buffers to small sizes
can lead to unpredictable stalls, too, so it might not be good
to do in a test case, either.
---
test/lib_read_write.rb | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 26e7aef..5f70964 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -7,7 +7,12 @@ $-w = true
require 'kgio'
module LibReadWriteTest
- RANDOM_BLOB = File.open("/dev/urandom") { |fp| fp.read(10 * 1024 * 1024) }
+ RANDOM_BLOB = File.open("/dev/urandom") do |fp|
+ nr = 31
+ buf = fp.read(nr)
+ # get roughly a 20MB block of random data
+ (buf * (20 * 1024 * 1024 / nr)) + (buf * rand(123))
+ end
def teardown
@rd.close if defined?(@rd) && ! @rd.closed?
@@ -369,7 +374,7 @@ module LibReadWriteTest
@nr += 1
IO.select(nil, [self])
end
- buf = "." * 1024 * 1024 * 10
+ buf = RANDOM_BLOB
thr = Thread.new { @wr.kgio_write(buf) }
Thread.pass until thr.stop?
readed = @rd.read(buf.size)
@@ -385,7 +390,7 @@ module LibReadWriteTest
@nr += 1
IO.select(nil, [self])
end
- buf = ["." * 1024] * 1024 * 10
+ buf = [ RANDOM_BLOB, RANDOM_BLOB ]
buf_size = buf.inject(0){|c, s| c + s.size}
thr = Thread.new { @wr.kgio_writev(buf) }
Thread.pass until thr.stop?
--
EW
reply other threads:[~2016-12-16 10:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161216102955.13495-1-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.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.
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).