ruby-changes:20076
From: sorah <ko1@a...>
Date: Thu, 16 Jun 2011 20:24:35 +0900 (JST)
Subject: [ruby-changes:20076] sorah:r32123 (trunk): * test/testunit/test_parallel.rb: Fix Regexp for test.
sorah 2011-06-16 20:24:23 +0900 (Thu, 16 Jun 2011) New Revision: 32123 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32123 Log: * test/testunit/test_parallel.rb: Fix Regexp for test. * test/testunit/tests_for_parallel/test_third.rb: Use Test::Unit::TestCase#on_parallel_worker? for detecting worker. * lib/test/unit/testcase.rb(Test::Unit::TestCase#on_parallel_worker?): New Method Test::Unit::TestCase#on_parallel_worker? returns true when a testcase is running on parallel worker. * lib/test/unit/parallel.rb(Test::Unit::TestCase#on_parallel_worker?): ditto. Modified files: trunk/ChangeLog trunk/lib/test/unit/parallel.rb trunk/lib/test/unit/testcase.rb trunk/test/testunit/test_parallel.rb trunk/test/testunit/tests_for_parallel/test_third.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 32122) +++ ChangeLog (revision 32123) @@ -1,3 +1,16 @@ +Thu Jun 16 20:06:15 2011 Shota Fukumori <sorah@t...> + + * test/testunit/test_parallel.rb: Fix Regexp for test. + + * test/testunit/tests_for_parallel/test_third.rb: Use + Test::Unit::TestCase#on_parallel_worker? for detecting worker. + + * lib/test/unit/testcase.rb(Test::Unit::TestCase#on_parallel_worker?): + New Method Test::Unit::TestCase#on_parallel_worker? returns true + when a testcase is running on parallel worker. + * lib/test/unit/parallel.rb(Test::Unit::TestCase#on_parallel_worker?): + ditto. + Thu Jun 16 19:27:12 2011 Hiroshi Nakamura <nahi@r...> * test/test_securerandom.rb: Add testcase. This testcase does NOT aim Index: lib/test/unit/testcase.rb =================================================================== --- lib/test/unit/testcase.rb (revision 32122) +++ lib/test/unit/testcase.rb (revision 32123) @@ -8,6 +8,10 @@ class TestCase < MiniTest::Unit::TestCase include Assertions + def on_parallel_worker? + false + end + def run runner @options = runner.options super runner Index: lib/test/unit/parallel.rb =================================================================== --- lib/test/unit/parallel.rb (revision 32122) +++ lib/test/unit/parallel.rb (revision 32123) @@ -2,6 +2,12 @@ module Test module Unit + class TestCase < MiniTest::Unit::TestCase + def on_parallel_worker? + true + end + end + class Worker < Runner class << self undef autorun Index: test/testunit/tests_for_parallel/test_third.rb =================================================================== --- test/testunit/tests_for_parallel/test_third.rb (revision 32122) +++ test/testunit/tests_for_parallel/test_third.rb (revision 32123) @@ -3,7 +3,8 @@ class TestD < TestCaseForParallelTest def ptest_fail_at_worker - if /test\/unit\/parallel\.rb/ =~ $0 + #if /test\/unit\/parallel\.rb/ =~ $0 + if on_parallel_worker? assert_equal(0,1) end end Index: test/testunit/test_parallel.rb =================================================================== --- test/testunit/test_parallel.rb (revision 32122) +++ test/testunit/test_parallel.rb (revision 32123) @@ -122,7 +122,7 @@ def spawn_runner(*opt_args) @test_out, o = IO.pipe @test_pid = spawn(*@options[:ruby], TESTS+"/runner.rb", - "-j","t2",*opt_args, out: o, err: o) + "-j","t1",*opt_args, out: o, err: o) o.close end @@ -153,14 +153,13 @@ def test_should_run_all_without_any_leaks spawn_runner buf = timeout(10){@test_out.read} - assert_match(/^\.*(\.SF\.*F|F\.*\.+SF)\.*$/,buf) + assert_match(/^[SF\.]{7}$/,buf) end def test_should_retry_failed_on_workers spawn_runner buf = timeout(10){@test_out.read} assert_match(/^Retrying\.+$/,buf) - assert_match(/^\.*SF\.*$/,buf) end def test_no_retry_option -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/