sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: [sleepy.penguin] [PATCH 1/6] test_epoll: fix timing error in test
Date: Thu, 11 Apr 2013 04:17:30 +0000	[thread overview]
Message-ID: <1365653855-1101-2-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: 1365653855-1101-1-git-send-email-normalperson@yhbt.net

We need to record the time before the thread is spawned.
---
 test/test_epoll.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test_epoll.rb b/test/test_epoll.rb
index fd22654..1e9a068 100644
--- a/test/test_epoll.rb
+++ b/test/test_epoll.rb
@@ -26,12 +26,12 @@ def test_constants
 
   def test_cross_thread
     tmp = []
-    Thread.new { sleep 0.100; @ep.add(@wr, Epoll::OUT) }
     t0 = Time.now
+    Thread.new { sleep 0.100; @ep.add(@wr, Epoll::OUT) }
     @ep.wait { |flags,obj| tmp << [ flags, obj ] }
     elapsed = Time.now - t0
     assert elapsed >= 0.100
-    assert_equal [[Epoll::OUT, @wr]], tmp
+    assert_equal [[Epoll::OUT, @wr]], tmp, tmp.inspect
   end
 
   def test_fork_safe
-- 
1.8.2.279.g631bc94



  reply	other threads:[~2013-04-11  4:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11  4:17 [sleepy.penguin] [PATCH 0/6] epoll wrapper cleanups Eric Wong
2013-04-11  4:17 ` Eric Wong [this message]
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 2/6] test_epoll: synchronize writes to the pipe array Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 3/6] split Epoll and Epoll::IO, rewrite Epoll in Ruby Eric Wong
2013-04-12 20:38   ` Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 4/6] epoll: implement thread-safety for mark/flag arrays Eric Wong
2013-04-12 21:18   ` Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 5/6] epoll: cache alignment for per-thread structure Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 6/6] avoid ENOMEM checking in common code paths 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: https://yhbt.net/sleepy_penguin/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365653855-1101-2-git-send-email-normalperson@yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=sleepy.penguin@librelist.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://yhbt.net/sleepy_penguin.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).