about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2010-09-26 06:01:23 +0000
committerEric Wong <e@yhbt.net>2010-09-26 06:06:52 +0000
commit29bbb053277e9c054f1433c66a2e83ada44a5e8d (patch)
tree42d9436368b4ac62b0a2c70ae283f86803060f67
parent43124e76e219d0be968fdeb09f6389d6895b0caf (diff)
downloadsleepy_penguin-29bbb053277e9c054f1433c66a2e83ada44a5e8d.tar.gz
Some of the GC tests aren't realistic, but if they work in MRI
then we can expect them to work reasonably well everywhere.
-rw-r--r--test/test_epoll.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/test_epoll.rb b/test/test_epoll.rb
index c6a11ed..e7d0798 100644
--- a/test/test_epoll.rb
+++ b/test/test_epoll.rb
@@ -7,12 +7,17 @@ require 'sleepy_penguin'
 
 class TestEpoll < Test::Unit::TestCase
   include SleepyPenguin
+  RBX = defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'rbx')
 
   def setup
     @rd, @wr = IO.pipe
     @ep = Epoll.new
   end
 
+  def teardown
+    [ @rd, @wr, @ep ].each { |io| io.close unless io.closed? }
+  end
+
   def test_cross_thread
     tmp = []
     Thread.new { sleep 0.100; @ep.add(@wr, Epoll::OUT) }
@@ -138,7 +143,7 @@ class TestEpoll < Test::Unit::TestCase
     assert((time[:EP] - time[:USR1]) < 0.15)
     ensure
       trap(:USR1, 'DEFAULT')
-  end
+  end unless RBX
 
   def test_close
     @ep.add @rd, Epoll::IN
@@ -191,7 +196,7 @@ class TestEpoll < Test::Unit::TestCase
   def test_gc
     assert_nothing_raised { 4096.times { Epoll.new } }
     assert ! @ep.closed?
-  end
+  end unless RBX
 
   def test_gc_to_io
     assert_nothing_raised do
@@ -201,7 +206,7 @@ class TestEpoll < Test::Unit::TestCase
       end
     end
     assert ! @ep.closed?
-  end
+  end unless RBX
 
   def test_clone
     tmp = []
@@ -210,6 +215,7 @@ class TestEpoll < Test::Unit::TestCase
     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 }
   end
 
   def test_dup
@@ -219,6 +225,7 @@ class TestEpoll < Test::Unit::TestCase
     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 }
   end
 
   def test_set_idempotency