ruby-changes:34204
From: akr <ko1@a...>
Date: Mon, 2 Jun 2014 09:16:40 +0900 (JST)
Subject: [ruby-changes:34204] akr:r46293 (trunk): * test/drb: Wrap tests definitions by DRbTests module. This makes
akr 2014-06-01 12:07:58 +0900 (Sun, 01 Jun 2014) New Revision: 46293 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=46293&view=revision Log: * test/drb: Wrap tests definitions by DRbTests module. This makes several tests (ACLEntryTest, TestBug4409, etc.) easier to understand that they are tests for DRb. Modified files: trunk/ChangeLog trunk/test/drb/drbtest.rb trunk/test/drb/ignore_test_drb.rb trunk/test/drb/test_acl.rb trunk/test/drb/test_drb.rb trunk/test/drb/test_drbssl.rb trunk/test/drb/test_drbunix.rb trunk/test/drb/ut_array_drbssl.rb trunk/test/drb/ut_drb.rb trunk/test/drb/ut_drb_drbssl.rb trunk/test/drb/ut_drb_drbunix.rb trunk/test/drb/ut_eq.rb trunk/test/drb/ut_eval.rb trunk/test/drb/ut_large.rb trunk/test/drb/ut_timerholder.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 46292) +++ ChangeLog (revision 46293) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Jun 1 12:05:10 2014 Tanaka Akira <akr@f...> + + * test/drb: Wrap tests definitions by DRbTests module. This makes + several tests (ACLEntryTest, TestBug4409, etc.) easier to understand + that they are tests for DRb. + Sun Jun 1 11:36:25 2014 Tanaka Akira <akr@f...> * lib/rinda/ring.rb (RingFinger#make_socket): Close the socket on Index: test/drb/ut_eq.rb =================================================================== --- test/drb/ut_eq.rb (revision 46292) +++ test/drb/ut_eq.rb (revision 46293) @@ -1,6 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/test/drb/ut_eq.rb#L1 require 'drb/drb' require 'drb/extserv' +module DRbTests + class Foo include DRbUndumped end @@ -17,6 +19,8 @@ class Bar https://github.com/ruby/ruby/blob/trunk/test/drb/ut_eq.rb#L19 end end +end + if __FILE__ == $0 def ARGV.shift it = super() @@ -24,8 +28,9 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_eq.rb#L28 it end - DRb.start_service('druby://localhost:0', Bar.new) + DRb.start_service('druby://localhost:0', DRbTests::Bar.new) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.stop_service if es.alive? end + Index: test/drb/ut_drb.rb =================================================================== --- test/drb/ut_drb.rb (revision 46292) +++ test/drb/ut_drb.rb (revision 46293) @@ -2,6 +2,8 @@ require 'drb/drb' https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb.rb#L2 require 'drb/extserv' require 'timeout' +module DRbTests + class XArray < Array def initialize(ary) ary.each do |x| @@ -147,6 +149,8 @@ class DRbEx https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb.rb#L149 end end +end + if __FILE__ == $0 def ARGV.shift it = super() @@ -156,7 +160,7 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb.rb#L160 DRb::DRbServer.default_argc_limit(8) DRb::DRbServer.default_load_limit(4096) - DRb.start_service('druby://localhost:0', DRbEx.new) + DRb.start_service('druby://localhost:0', DRbTests::DRbEx.new) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.stop_service if es.alive? Index: test/drb/ut_timerholder.rb =================================================================== --- test/drb/ut_timerholder.rb (revision 46292) +++ test/drb/ut_timerholder.rb (revision 46293) @@ -2,6 +2,8 @@ require 'runit/testcase' https://github.com/ruby/ruby/blob/trunk/test/drb/ut_timerholder.rb#L2 require 'runit/cui/testrunner' require 'timerholder' +module DRbTests + class TimerHolderTest < RUNIT::TestCase def do_test(timeout, keeper_sleep = nil) holder = TimerHolder.new(timeout) @@ -44,6 +46,8 @@ class TimerHolderTest < RUNIT::TestCase https://github.com/ruby/ruby/blob/trunk/test/drb/ut_timerholder.rb#L46 end end +end + if __FILE__ == $0 - RUNIT::CUI::TestRunner.run(TimerHolderTest.suite) + RUNIT::CUI::TestRunner.run(DRbTests::TimerHolderTest.suite) end Index: test/drb/test_drbssl.rb =================================================================== --- test/drb/test_drbssl.rb (revision 46292) +++ test/drb/test_drbssl.rb (revision 46293) @@ -5,6 +5,8 @@ begin https://github.com/ruby/ruby/blob/trunk/test/drb/test_drbssl.rb#L5 rescue LoadError end +module DRbTests + if Object.const_defined?("OpenSSL") @@ -60,3 +62,5 @@ end https://github.com/ruby/ruby/blob/trunk/test/drb/test_drbssl.rb#L62 end + +end Index: test/drb/ut_drb_drbssl.rb =================================================================== --- test/drb/ut_drb_drbssl.rb (revision 46292) +++ test/drb/ut_drb_drbssl.rb (revision 46293) @@ -8,7 +8,9 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb_drbssl.rb#L8 it end - TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_ + module DRbTests + + TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_ -----BEGIN DH PARAMETERS----- MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0 pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG @@ -16,10 +18,12 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOP https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb_drbssl.rb#L18 -----END DH PARAMETERS----- _end_of_pem_ - TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16) + TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16) + + end config = Hash.new - config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 } + config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 } config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER config[:SSLVerifyCallback] = lambda{|ok,x509_store| true @@ -29,7 +33,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOP https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb_drbssl.rb#L33 DRb::DRbServer.default_argc_limit(8) DRb::DRbServer.default_load_limit(4096) - DRb.start_service('drbssl://localhost:0', DRbEx.new, config) + DRb.start_service('drbssl://localhost:0', DRbTests::DRbEx.new, config) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.stop_service if es.alive? Index: test/drb/test_acl.rb =================================================================== --- test/drb/test_acl.rb (revision 46292) +++ test/drb/test_acl.rb (revision 46293) @@ -7,6 +7,8 @@ https://github.com/ruby/ruby/blob/trunk/test/drb/test_acl.rb#L7 require 'test/unit' require 'drb/acl' +module DRbTests + class SampleHosts def initialize list = %w(127.0.0.1 localhost @@ -192,4 +194,4 @@ class ACLTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/drb/test_acl.rb#L194 end end - +end Index: test/drb/ut_array_drbssl.rb =================================================================== --- test/drb/ut_array_drbssl.rb (revision 46292) +++ test/drb/ut_array_drbssl.rb (revision 46293) @@ -9,7 +9,9 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_array_drbssl.rb#L9 it end - TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_ + module DRbTests + + TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_ -----BEGIN DH PARAMETERS----- MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0 pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG @@ -17,10 +19,12 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOP https://github.com/ruby/ruby/blob/trunk/test/drb/ut_array_drbssl.rb#L19 -----END DH PARAMETERS----- _end_of_pem_ - TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16) + TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16) + + end config = Hash.new - config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 } + config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 } config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER config[:SSLVerifyCallback] = lambda{|ok,x509_store| true Index: test/drb/ut_eval.rb =================================================================== --- test/drb/ut_eval.rb (revision 46292) +++ test/drb/ut_eval.rb (revision 46293) @@ -1,6 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/test/drb/ut_eval.rb#L1 require 'drb/drb' require 'drb/extserv' +module DRbTests + class EvalAttack def initialize @four = DRb::DRbServer.new('druby://localhost:0', self, {:safe_level => 4}) @@ -15,6 +17,8 @@ class EvalAttack https://github.com/ruby/ruby/blob/trunk/test/drb/ut_eval.rb#L17 end end +end + if __FILE__ == $0 def ARGV.shift @@ -25,7 +29,7 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_eval.rb#L29 $SAFE = 1 - DRb.start_service('druby://localhost:0', EvalAttack.new, {:safe_level => 2}) + DRb.start_service('druby://localhost:0', DRbTests::EvalAttack.new, {:safe_level => 2}) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.stop_service if es.alive? Index: test/drb/ut_large.rb =================================================================== --- test/drb/ut_large.rb (revision 46292) +++ test/drb/ut_large.rb (revision 46293) @@ -2,6 +2,8 @@ require 'drb/drb' https://github.com/ruby/ruby/blob/trunk/test/drb/ut_large.rb#L2 require 'drb/extserv' require 'timeout' +module DRbTests + class DRbLarge include DRbUndumped @@ -22,6 +24,8 @@ class DRbLarge https://github.com/ruby/ruby/blob/trunk/test/drb/ut_large.rb#L24 end end +end + if __FILE__ == $0 def ARGV.shift it = super() @@ -31,7 +35,7 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_large.rb#L35 DRb::DRbServer.default_argc_limit(3) DRb::DRbServer.default_load_limit(100000) - DRb.start_service('druby://localhost:0', DRbLarge.new) + DRb.start_service('druby://localhost:0', DRbTests::DRbLarge.new) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.stop_service if es.alive? Index: test/drb/test_drb.rb =================================================================== --- test/drb/test_drb.rb (revision 46292) +++ test/drb/test_drb.rb (revision 46293) @@ -1,5 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/drb/test_drb.rb#L1 require_relative 'drbtest' +module DRbTests + class TestDRbCore < Test::Unit::TestCase include DRbCore @@ -320,3 +322,5 @@ class TestBug4409 < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/drb/test_drb.rb#L322 assert(@there.foo?(foo)) end end + +end Index: test/drb/drbtest.rb =================================================================== --- test/drb/drbtest.rb (revision 46292) +++ test/drb/drbtest.rb (revision 46293) @@ -5,6 +5,8 @@ require 'timeout' https://github.com/ruby/ruby/blob/trunk/test/drb/drbtest.rb#L5 require 'shellwords' require_relative '../ruby/envutil' +module DRbTests + class DRbService @@manager = DRb::ExtServManager.new @@ruby = Shellwords.escape(EnvUtil.rubybin) @@ -138,11 +140,11 @@ module DRbCore https://github.com/ruby/ruby/blob/trunk/test/drb/drbtest.rb#L140 def test_02_unknown obj = @there.unknown_class assert_kind_of(DRb::DRbUnknown, obj) - assert_equal('Unknown2', obj.name) + assert_equal('DRbTests::Unknown2', obj.name) obj = @there.unknown_module assert_kind_of(DRb::DRbUnknown, obj) - assert_equal('DRbEx::', obj.name) + assert_equal('DRbTests::DRbEx::', obj.name) assert_raise(DRb::DRbUnknownError) do @there.unknown_error @@ -364,3 +366,5 @@ module DRbAry https://github.com/ruby/ruby/blob/trunk/test/drb/drbtest.rb#L366 EOS end + +end Index: test/drb/ignore_test_drb.rb =================================================================== --- test/drb/ignore_test_drb.rb (revision 46292) +++ test/drb/ignore_test_drb.rb (revision 46293) @@ -1,5 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/drb/ignore_test_drb.rb#L1 require 'drbtest' +module DRbTests + class TestDRbReusePort < Test::Unit::TestCase include DRbAry @@ -8,3 +10,4 @@ class TestDRbReusePort < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/drb/ignore_test_drb.rb#L10 end end +end Index: test/drb/ut_drb_drbunix.rb =================================================================== --- test/drb/ut_drb_drbunix.rb (revision 46292) +++ test/drb/ut_drb_drbunix.rb (revision 46293) @@ -9,7 +9,7 @@ if __FILE__ == $0 https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb_drbunix.rb#L9 DRb::DRbServer.default_argc_limit(8) DRb::DRbServer.default_load_limit(4096) - DRb.start_service('drbunix:', DRbEx.new) + DRb.start_service('drbunix:', DRbTests::DRbEx.new) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.stop_service if es.alive? Index: test/drb/test_drbunix.rb =================================================================== --- test/drb/test_drbunix.rb (revision 46292) +++ test/drb/test_drbunix.rb (revision 46293) @@ -5,6 +5,8 @@ begin https://github.com/ruby/ruby/blob/trunk/test/drb/test_drbunix.rb#L5 rescue LoadError end +module DRbTests + if Object.const_defined?("UNIXServer") @@ -44,3 +46,5 @@ end https://github.com/ruby/ruby/blob/trunk/test/drb/test_drbunix.rb#L46 end + +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/