ruby-changes:51620
From: normal <ko1@a...>
Date: Tue, 3 Jul 2018 09:29:10 +0900 (JST)
Subject: [ruby-changes:51620] normal:r63831 (trunk): test/ruby/test_signal.rb: speedup some test by disabling RubyGems
normal 2018-07-03 09:29:06 +0900 (Tue, 03 Jul 2018) New Revision: 63831 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63831 Log: test/ruby/test_signal.rb: speedup some test by disabling RubyGems test_signame_delivered is reduced from 1.0s to 0.1s Modified files: trunk/test/ruby/test_signal.rb Index: test/ruby/test_signal.rb =================================================================== --- test/ruby/test_signal.rb (revision 63830) +++ test/ruby/test_signal.rb (revision 63831) @@ -28,7 +28,8 @@ class TestSignal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_signal.rb#L28 def test_signal_process_group bug4362 = '[ruby-dev:43169]' assert_nothing_raised(bug4362) do - pid = Process.spawn(EnvUtil.rubybin, '-e', 'sleep 10', :pgroup => true) + cmd = [ EnvUtil.rubybin, '--disable=gems' '-e', 'sleep 10' ] + pid = Process.spawn(*cmd, :pgroup => true) Process.kill(:"-TERM", pid) Process.waitpid(pid) assert_equal(true, $?.signaled?) @@ -44,7 +45,7 @@ class TestSignal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_signal.rb#L45 sig = "INT" term = :KILL end - IO.popen([EnvUtil.rubybin, '-e', <<-"End"], 'r+') do |io| + IO.popen([EnvUtil.rubybin, '--disable=gems', '-e', <<-"End"], 'r+') do |io| Signal.trap(:#{sig}, "EXIT") STDOUT.syswrite("a") Thread.start { sleep(2) } @@ -232,18 +233,18 @@ class TestSignal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_signal.rb#L233 end def test_signame_delivered - 10.times do - IO.popen([EnvUtil.rubybin, "-e", <<EOS, :err => File::NULL]) do |child| - Signal.trap("INT") do |signo| - signame = Signal.signame(signo) - Marshal.dump(signame, STDOUT) - STDOUT.flush - exit 0 - end - Process.kill("INT", $$) - sleep 1 # wait signal deliver -EOS + args = [EnvUtil.rubybin, "--disable=gems", "-e", <<"", :err => File::NULL] + Signal.trap("INT") do |signo| + signame = Signal.signame(signo) + Marshal.dump(signame, STDOUT) + STDOUT.flush + exit 0 + end + Process.kill("INT", $$) + sleep 1 # wait signal deliver + 10.times do + IO.popen(args) do |child| signame = Marshal.load(child) assert_equal("INT", signame) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/