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 01/17] test_epoll: remove assert_nothing_raised
Date: Tue, 30 Apr 2013 02:39:26 +0000	[thread overview]
Message-ID: <1367289582-31293-2-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: 1367289582-31293-1-git-send-email-normalperson@yhbt.net

assert_nothing_raised hides backtraces on real errors,
so we'll stop doing it, now.
---
 test/test_epoll.rb | 60 ++++++++++++++++++++++--------------------------------
 1 file changed, 24 insertions(+), 36 deletions(-)

diff --git a/test/test_epoll.rb b/test/test_epoll.rb
index 7c648ff..b2c5c48 100644
--- a/test/test_epoll.rb
+++ b/test/test_epoll.rb
@@ -122,11 +122,9 @@ def test_edge_accept
   end
 
   def teardown
-    assert_nothing_raised do
-      @rd.close unless @rd.closed?
-      @wr.close unless @wr.closed?
-      @ep.close unless @ep.closed?
-    end
+    @rd.close unless @rd.closed?
+    @wr.close unless @wr.closed?
+    @ep.close unless @ep.closed?
   end
 
   def test_max_events_big
@@ -170,11 +168,9 @@ def test_signal_safe_wait_forever
       exit!(0)
     end
     time[:START_WAIT] = Time.now
-    assert_nothing_raised do
-      @ep.wait do |flags, obj|
-        tmp << [ flags, obj ]
-        time[:EP] = Time.now
-      end
+    @ep.wait do |flags, obj|
+      tmp << [ flags, obj ]
+      time[:EP] = Time.now
     end
     assert_equal([[Epoll::IN, @rd]], tmp)
     _, status = Process.waitpid2(pid)
@@ -222,12 +218,10 @@ def test_hup
 
   def test_multiple
     r, w = IO.pipe
-    assert_nothing_raised do
-      @ep.add r, Epoll::IN
-      @ep.add @rd, Epoll::IN
-      @ep.add w, Epoll::OUT
-      @ep.add @wr, Epoll::OUT
-    end
+    @ep.add r, Epoll::IN
+    @ep.add @rd, Epoll::IN
+    @ep.add w, Epoll::OUT
+    @ep.add @wr, Epoll::OUT
     tmp = []
     @ep.wait { |flags, obj| tmp << [ flags, obj ] }
     assert_equal 2, tmp.size
@@ -238,16 +232,14 @@ def test_multiple
   end
 
   def test_gc
-    assert_nothing_raised { 4096.times { Epoll.new } }
+    4096.times { Epoll.new }
     assert ! @ep.closed?
   end unless RBX
 
   def test_gc_to_io
-    assert_nothing_raised do
-      4096.times do
-        ep = Epoll.new
-        assert_kind_of IO, ep.to_io
-      end
+    4096.times do
+      ep = Epoll.new
+      assert_kind_of IO, ep.to_io
     end
     assert ! @ep.closed?
   end unless RBX
@@ -259,7 +251,7 @@ def test_clone
     clone.add @wr, Epoll::OUT
     @ep.wait(nil, 0) { |flags, obj| tmp << [ flags, obj ] }
     assert_equal([[Epoll::OUT, @wr]], tmp)
-    assert_nothing_raised { clone.close }
+    clone.close
   end
 
   def test_dup
@@ -269,16 +261,14 @@ def test_dup
     clone.add @wr, Epoll::OUT
     @ep.wait(nil, 0) { |flags, obj| tmp << [ flags, obj ] }
     assert_equal([[Epoll::OUT, @wr]], tmp)
-    assert_nothing_raised { clone.close }
+    clone.close
   end
 
   def test_set_idempotency
-    assert_nothing_raised do
-      @ep.set @rd, Epoll::IN
-      @ep.set @rd, Epoll::IN
-      @ep.set @wr, Epoll::OUT
-      @ep.set @wr, Epoll::OUT
-    end
+    @ep.set @rd, Epoll::IN
+    @ep.set @rd, Epoll::IN
+    @ep.set @wr, Epoll::OUT
+    @ep.set @wr, Epoll::OUT
   end
 
   def test_wait_timeout
@@ -290,10 +280,8 @@ def test_wait_timeout
 
   def test_del
     assert_raises(Errno::ENOENT) { @ep.del(@rd) }
-    assert_nothing_raised do
-      @ep.add(@rd, Epoll::IN)
-      @ep.del(@rd)
-    end
+    @ep.add(@rd, Epoll::IN)
+    @ep.del(@rd)
   end
 
   def test_wait_read
@@ -368,7 +356,7 @@ def test_new
   def test_delete
     assert_nil @ep.delete(@rd)
     assert_nil @ep.delete(@wr)
-    assert_nothing_raised { @ep.add @rd, Epoll::IN }
+    @ep.add @rd, Epoll::IN
     assert_equal @rd, @ep.delete(@rd)
     assert_nil @ep.delete(@rd)
   end
@@ -471,7 +459,7 @@ def test_epoll_wait_signal_torture
       exit!(0)
     end
     while tmp.empty?
-      assert_nothing_raised { @ep.wait(nil, 100) { |flags,obj| tmp << obj } }
+      @ep.wait(nil, 100) { |flags,obj| tmp << obj }
       empty += 1
     end
     _, status = Process.waitpid2(pid)
-- 
1.8.2.1.367.gc875ca7



  reply	other threads:[~2013-04-30  2:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30  2:39 [sleepy.penguin] [PATCH 0/17] kqueue and epoll fixes Eric Wong
2013-04-30  2:39 ` Eric Wong [this message]
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 02/17] test: remove Rubinius-specific checks and skips Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 03/17] test_epoll: avoid sleeping inside a signal handler Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 04/17] fork-safe "to_io" in high-level epoll/kqueue Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 05/17] test_kqueue: join thread after test Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 06/17] test_kqueue_io: test for multiple event return Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 07/17] test_timerfd: relax timing-sensitive test Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 08/17] kqueue: set zero timeout if not retrieving events Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 09/17] test_epoll: workaround MRI 1.8 threading bug Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 10/17] test_kqueue_io: join thread in test when done using Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 11/17] test_kqueue: only test if IO#autoclose= exists Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 12/17] kqueue/io: fix MRI 1.8 support code for event retrieval Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 13/17] kqueue: workaround lack of RSTRUCT* macros on Rubinius Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 14/17] test_epoll: join thread before return from test Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 15/17] test_epoll: increase delay between signal spamming Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 16/17] epoll: clear FD marks snapshot before returning Eric Wong
2013-04-30  2:39 ` [sleepy.penguin] [PATCH 17/17] test_epoll: workaround race condition in test_close 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=1367289582-31293-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).