mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit.rb: Add new class variable @@testfile_prefix
.
This is for changing test name prefix. (For testing) * test/testunit/tests_for_parallel/ptest_first.rb: Renamed from test_first.rb * test/testunit/tests_for_parallel/ptest_second.rb: Renamed from test_second.rb * test/testunit/tests_for_parallel/ptest_third.rb: Renamed from test_third.rb * test/testunit/tests_for_parallel/ptest_forth.rb: Renamed from test_forth.rb * test/testunit/tests_for_parallel/runner.rb: Remove misc.rb * test/testunit/tests_for_parallel/ptest_first.rb: ditto. * test/testunit/tests_for_parallel/ptest_second.rb: ditto. * test/testunit/tests_for_parallel/ptest_third.rb: ditto. * test/testunit/tests_for_parallel/ptest_forth.rb: ditto. * test/testunit/tests_for_parallel/misc.rb: Removed because no longer needed. * test/testunit/test_parallel.rb: Fix assertions for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9cf9d5eaf7
commit
7506a580fe
12 changed files with 91 additions and 98 deletions
|
@ -37,11 +37,10 @@ module TestParallel
|
|||
def test_run
|
||||
timeout(10) do
|
||||
assert_match(/^ready/,@worker_out.gets)
|
||||
@worker_in.puts "run #{TESTS}/test_first.rb ptest"
|
||||
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
||||
assert_match(/^okay/,@worker_out.gets)
|
||||
assert_match(/^p/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^ready/,@worker_out.gets)
|
||||
end
|
||||
end
|
||||
|
@ -49,13 +48,12 @@ module TestParallel
|
|||
def test_run_multiple_testcase_in_one_file
|
||||
timeout(10) do
|
||||
assert_match(/^ready/,@worker_out.gets)
|
||||
@worker_in.puts "run #{TESTS}/test_second.rb ptest"
|
||||
@worker_in.puts "run #{TESTS}/ptest_second.rb test"
|
||||
assert_match(/^okay/,@worker_out.gets)
|
||||
assert_match(/^p/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^p/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^ready/,@worker_out.gets)
|
||||
end
|
||||
end
|
||||
|
@ -63,13 +61,12 @@ module TestParallel
|
|||
def test_accept_run_command_multiple_times
|
||||
timeout(10) do
|
||||
assert_match(/^ready/,@worker_out.gets)
|
||||
@worker_in.puts "run #{TESTS}/test_first.rb ptest"
|
||||
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
||||
assert_match(/^okay/,@worker_out.gets)
|
||||
assert_match(/^p/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
assert_match(/^ready/,@worker_out.gets)
|
||||
@worker_in.puts "run #{TESTS}/test_second.rb ptest"
|
||||
@worker_in.puts "run #{TESTS}/ptest_second.rb test"
|
||||
assert_match(/^okay/,@worker_out.gets)
|
||||
assert_match(/^p/,@worker_out.gets)
|
||||
assert_match(/^done/,@worker_out.gets)
|
||||
|
@ -81,24 +78,23 @@ module TestParallel
|
|||
|
||||
def test_p
|
||||
timeout(10) do
|
||||
@worker_in.puts "run #{TESTS}/test_first.rb ptest"
|
||||
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
||||
while buf = @worker_out.gets
|
||||
break if /^p (.+?)$/ =~ buf
|
||||
end
|
||||
assert_match(/TestA#ptest_nothing_test = \d+\.\d+ s = \.\n/, $1.chomp.unpack("m")[0])
|
||||
assert_match(/TestA#test_nothing_test = \d+\.\d+ s = \.\n/, $1.chomp.unpack("m")[0])
|
||||
end
|
||||
end
|
||||
|
||||
def test_done
|
||||
timeout(10) do
|
||||
@worker_in.puts "run #{TESTS}/test_forth.rb ptest"
|
||||
@worker_in.puts "run #{TESTS}/ptest_forth.rb test"
|
||||
i = 0
|
||||
while buf = @worker_out.gets
|
||||
if /^done (.+?)$/ =~ buf
|
||||
i += 1
|
||||
break if i == 2 # Break at 2nd "done"
|
||||
end
|
||||
end
|
||||
5.times { @worker_out.gets }
|
||||
buf = @worker_out.gets
|
||||
assert_match(/^done (.+?)$/, buf)
|
||||
|
||||
/^done (.+?)$/ =~ buf
|
||||
|
||||
result = Marshal.load($1.chomp.unpack("m")[0])
|
||||
|
||||
|
@ -107,8 +103,8 @@ module TestParallel
|
|||
assert_kind_of(Array,result[2])
|
||||
assert_kind_of(Array,result[3])
|
||||
assert_kind_of(Array,result[4])
|
||||
assert_match(/Skipped:$/,result[2][0])
|
||||
assert_match(/Failure:$/,result[2][1])
|
||||
assert_match(/Skipped:$/,result[2][1])
|
||||
assert_match(/Failure:$/,result[2][0])
|
||||
assert_equal(result[5], "TestE")
|
||||
end
|
||||
end
|
||||
|
@ -169,13 +165,13 @@ module TestParallel
|
|||
spawn_runner "--no-retry"
|
||||
buf = timeout(10){@test_out.read}
|
||||
refute_match(/^Retrying\.+$/,buf)
|
||||
assert_match(/^ +\d+\) Failure:\nptest_fail_at_worker\(TestD\)/,buf)
|
||||
assert_match(/^ +\d+\) Failure:\ntest_fail_at_worker\(TestD\)/,buf)
|
||||
end
|
||||
|
||||
def test_jobs_status
|
||||
spawn_runner "--jobs-status"
|
||||
buf = timeout(10){@test_out.read}
|
||||
assert_match(/\d+=test_(first|second|third|forth) */,buf)
|
||||
assert_match(/\d+=ptest_(first|second|third|forth) */,buf)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue