* 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:
parent
a15dfa6b4a
commit
288c18cdd8
13
ChangeLog
13
ChangeLog
@ -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>
|
Thu Jun 16 19:27:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
|
||||||
|
|
||||||
* test/test_securerandom.rb: Add testcase. This testcase does NOT aim
|
* test/test_securerandom.rb: Add testcase. This testcase does NOT aim
|
||||||
|
@ -2,6 +2,12 @@ require 'test/unit'
|
|||||||
|
|
||||||
module Test
|
module Test
|
||||||
module Unit
|
module Unit
|
||||||
|
class TestCase < MiniTest::Unit::TestCase
|
||||||
|
def on_parallel_worker?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class Worker < Runner
|
class Worker < Runner
|
||||||
class << self
|
class << self
|
||||||
undef autorun
|
undef autorun
|
||||||
|
@ -8,6 +8,10 @@ module Test
|
|||||||
class TestCase < MiniTest::Unit::TestCase
|
class TestCase < MiniTest::Unit::TestCase
|
||||||
include Assertions
|
include Assertions
|
||||||
|
|
||||||
|
def on_parallel_worker?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def run runner
|
def run runner
|
||||||
@options = runner.options
|
@options = runner.options
|
||||||
super runner
|
super runner
|
||||||
|
@ -122,7 +122,7 @@ module TestParallel
|
|||||||
def spawn_runner(*opt_args)
|
def spawn_runner(*opt_args)
|
||||||
@test_out, o = IO.pipe
|
@test_out, o = IO.pipe
|
||||||
@test_pid = spawn(*@options[:ruby], TESTS+"/runner.rb",
|
@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
|
o.close
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -153,14 +153,13 @@ module TestParallel
|
|||||||
def test_should_run_all_without_any_leaks
|
def test_should_run_all_without_any_leaks
|
||||||
spawn_runner
|
spawn_runner
|
||||||
buf = timeout(10){@test_out.read}
|
buf = timeout(10){@test_out.read}
|
||||||
assert_match(/^\.*(\.SF\.*F|F\.*\.+SF)\.*$/,buf)
|
assert_match(/^[SF\.]{7}$/,buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_should_retry_failed_on_workers
|
def test_should_retry_failed_on_workers
|
||||||
spawn_runner
|
spawn_runner
|
||||||
buf = timeout(10){@test_out.read}
|
buf = timeout(10){@test_out.read}
|
||||||
assert_match(/^Retrying\.+$/,buf)
|
assert_match(/^Retrying\.+$/,buf)
|
||||||
assert_match(/^\.*SF\.*$/,buf)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_retry_option
|
def test_no_retry_option
|
||||||
|
@ -3,7 +3,8 @@ require_relative "misc.rb"
|
|||||||
|
|
||||||
class TestD < TestCaseForParallelTest
|
class TestD < TestCaseForParallelTest
|
||||||
def ptest_fail_at_worker
|
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)
|
assert_equal(0,1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user