* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
sorah 2011-06-16 11:24:23 +00:00
parent a15dfa6b4a
commit 288c18cdd8
5 changed files with 27 additions and 4 deletions

View File

@ -1,3 +1,16 @@
Thu Jun 16 20:06:15 2011 Shota Fukumori <sorah@tubusu.net>
* 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@ruby-lang.org>
* test/test_securerandom.rb: Add testcase. This testcase does NOT aim

View File

@ -2,6 +2,12 @@ require 'test/unit'
module Test
module Unit
class TestCase < MiniTest::Unit::TestCase
def on_parallel_worker?
true
end
end
class Worker < Runner
class << self
undef autorun

View File

@ -8,6 +8,10 @@ module Test
class TestCase < MiniTest::Unit::TestCase
include Assertions
def on_parallel_worker?
false
end
def run runner
@options = runner.options
super runner

View File

@ -122,7 +122,7 @@ module TestParallel
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 @@ module TestParallel
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

View File

@ -3,7 +3,8 @@ require_relative "misc.rb"
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