Skip to content

Commit 15d2f7a

Browse files
committed
merge revision(s) r45953,r45961: [Backport ruby#9767]
* lib/test/unit/parallel.rb: fix test-all parallel failure if a test is skipped after raise. DL::TestFunc#test_sinf is skipped after raise on mingw ruby. But it causes Mashal.load failure due to undefined class/module DL::DLError when doing test-all parallel and test-all doesn't complete. We create new MiniTest::Skip object to avoid Mashal.load failure. [ruby-core:62133] [Bug ruby#9767] * test/testunit/test_parallel.rb (TestParallel): add a test. * test/testunit/tests_for_parallel/ptest_forth.rb: ditto. But it causes Marshal.load failure due to undefined class/module complete. We create new MiniTest::Skip object to avoid Marshal.load git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 44c8b12 commit 15d2f7a

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

ChangeLog

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
Wed Jul 23 23:49:59 2014 Hiroshi Shirosaki <[email protected]>
2+
3+
* lib/test/unit/parallel.rb: fix test-all parallel failure if a test
4+
is skipped after raise.
5+
DL::TestFunc#test_sinf is skipped after raise on mingw ruby.
6+
But it causes Marshal.load failure due to undefined class/module
7+
DL::DLError when doing test-all parallel and test-all doesn't
8+
complete. We create new MiniTest::Skip object to avoid Marshal.load
9+
failure.
10+
[ruby-core:62133] [Bug #9767]
11+
12+
* test/testunit/test_parallel.rb (TestParallel): add a test.
13+
14+
* test/testunit/tests_for_parallel/ptest_forth.rb: ditto.
15+
116
Wed Jul 23 23:11:28 2014 SHIBATA Hiroshi <[email protected]>
217

318
* test/socket/test_socket.rb: unix socket is required by test case.

lib/test/unit/parallel.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ def _report(res, *args) # :nodoc:
155155
end
156156

157157
def puke(klass, meth, e) # :nodoc:
158+
if e.is_a?(MiniTest::Skip)
159+
new_e = MiniTest::Skip.new(e.message)
160+
new_e.set_backtrace(e.backtrace)
161+
e = new_e
162+
end
158163
@partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)]
159164
super
160165
end

test/testunit/test_parallel.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,24 @@ def test_p
9090
def test_done
9191
timeout(10) do
9292
@worker_in.puts "run #{TESTS}/ptest_forth.rb test"
93-
6.times { @worker_out.gets }
93+
7.times { @worker_out.gets }
9494
buf = @worker_out.gets
9595
assert_match(/^done (.+?)$/, buf)
9696

9797
/^done (.+?)$/ =~ buf
9898

9999
result = Marshal.load($1.chomp.unpack("m")[0])
100100

101-
assert_equal(4, result[0])
101+
assert_equal(5, result[0])
102102
assert_equal(2, result[1])
103103
assert_kind_of(Array,result[2])
104104
assert_kind_of(Array,result[3])
105105
assert_kind_of(Array,result[4])
106106
assert_kind_of(Array,result[2][1])
107107
assert_kind_of(MiniTest::Assertion,result[2][0][2])
108108
assert_kind_of(MiniTest::Skip,result[2][1][2])
109-
assert_kind_of(Exception, result[2][2][2])
109+
assert_kind_of(MiniTest::Skip,result[2][2][2])
110+
assert_kind_of(Exception, result[2][3][2])
110111
assert_equal(result[5], "TestE")
111112
end
112113
end
@@ -156,7 +157,7 @@ def test_ignore_jzero
156157
def test_should_run_all_without_any_leaks
157158
spawn_runner
158159
buf = timeout(10){@test_out.read}
159-
assert_match(/^[SFE\.]{8}$/,buf)
160+
assert_match(/^[SFE\.]{9}$/,buf)
160161
end
161162

162163
def test_should_retry_failed_on_workers

test/testunit/tests_for_parallel/ptest_forth.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ def test_always_fail
1515
assert_equal(0,1)
1616
end
1717

18+
def test_skip_after_unknown_error
19+
begin
20+
raise UnknownError, "unknown error"
21+
rescue
22+
skip "after raise"
23+
end
24+
end
25+
1826
def test_unknown_error
1927
raise UnknownError, "unknown error"
2028
end

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-07-23"
3-
#define RUBY_PATCHLEVEL 181
3+
#define RUBY_PATCHLEVEL 182
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 7

0 commit comments

Comments
 (0)