aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-15 03:36:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-15 03:36:57 +0000
commit19853fc49b20626052d6cc92dbd7b08ecce03039 (patch)
tree2575286bce5050eb28e7af732946a05c1f9343ac /test/ruby
parent071b8d76f0e920e510ffcb3dc6028ee863112b13 (diff)
downloadruby-19853fc49b20626052d6cc92dbd7b08ecce03039.tar.gz
* test/ruby/test_io.rb (test_copy_stream_socket): wait a child process
before SIGUSR1 handler is removed. * test/pathname/test_pathname.rb (define_assertion): use line number for test method names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb29
1 files changed, 16 insertions, 13 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 0a100b1457..fba0800499 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -82,8 +82,8 @@ class TestIO < Test::Unit::TestCase
@usr1_rcvd = 0
trap(:USR1) { @usr1_rcvd += 1 }
yield
- ensure
- trap(:USR1, "DEFAULT")
+ ensure
+ trap(:USR1, "DEFAULT")
end
def test_pipe
@@ -610,19 +610,22 @@ class TestIO < Test::Unit::TestCase
end
trapping_usr1 do
nr = 10
- pid = fork do
+ begin
+ pid = fork do
+ s1.close
+ IO.select([s2])
+ Process.kill(:USR1, Process.ppid)
+ s2.read
+ end
+ s2.close
+ nr.times do
+ assert_equal megacontent.bytesize, IO.copy_stream("megasrc", s1)
+ end
+ assert_equal(1, @usr1_rcvd)
s1.close
- IO.select([s2])
- Process.kill(:USR1, Process.ppid)
- s2.read
- end
- s2.close
- nr.times do
- assert_equal megacontent.bytesize, IO.copy_stream("megasrc", s1)
+ ensure
+ _, status = Process.waitpid2(pid) if pid
end
- assert_equal(1, @usr1_rcvd)
- s1.close
- _, status = Process.waitpid2(pid)
assert status.success?, status.inspect
end
}