From 3eb0620c2a901b12e6fb752fd1ae668ed8f2b918 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 23 Jul 2014 14:53:36 +0000 Subject: [PATCH] merge revision(s) r45953,r45961: [Backport #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 #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 --- ChangeLog | 15 +++++++++++++++ lib/test/unit/parallel.rb | 5 +++++ test/testunit/test_parallel.rb | 9 +++++---- test/testunit/tests_for_parallel/ptest_forth.rb | 8 ++++++++ version.h | 2 +- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 226c955687..036e770ba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Wed Jul 23 23:49:59 2014 Hiroshi Shirosaki + + * 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 Marshal.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 Marshal.load + failure. + [ruby-core:62133] [Bug #9767] + + * test/testunit/test_parallel.rb (TestParallel): add a test. + + * test/testunit/tests_for_parallel/ptest_forth.rb: ditto. + Wed Jul 23 23:11:28 2014 SHIBATA Hiroshi * test/socket/test_socket.rb: unix socket is required by test case. diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb index c1ecf29263..92cc7ec44b 100644 --- a/lib/test/unit/parallel.rb +++ b/lib/test/unit/parallel.rb @@ -155,6 +155,11 @@ module Test end def puke(klass, meth, e) # :nodoc: + if e.is_a?(MiniTest::Skip) + new_e = MiniTest::Skip.new(e.message) + new_e.set_backtrace(e.backtrace) + e = new_e + end @partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)] super end diff --git a/test/testunit/test_parallel.rb b/test/testunit/test_parallel.rb index f1b903beef..6276aac8bd 100644 --- a/test/testunit/test_parallel.rb +++ b/test/testunit/test_parallel.rb @@ -90,7 +90,7 @@ module TestParallel def test_done timeout(10) do @worker_in.puts "run #{TESTS}/ptest_forth.rb test" - 6.times { @worker_out.gets } + 7.times { @worker_out.gets } buf = @worker_out.gets assert_match(/^done (.+?)$/, buf) @@ -98,7 +98,7 @@ module TestParallel result = Marshal.load($1.chomp.unpack("m")[0]) - assert_equal(4, result[0]) + assert_equal(5, result[0]) assert_equal(2, result[1]) assert_kind_of(Array,result[2]) assert_kind_of(Array,result[3]) @@ -106,7 +106,8 @@ module TestParallel assert_kind_of(Array,result[2][1]) assert_kind_of(MiniTest::Assertion,result[2][0][2]) assert_kind_of(MiniTest::Skip,result[2][1][2]) - assert_kind_of(Exception, result[2][2][2]) + assert_kind_of(MiniTest::Skip,result[2][2][2]) + assert_kind_of(Exception, result[2][3][2]) assert_equal(result[5], "TestE") end end @@ -156,7 +157,7 @@ module TestParallel def test_should_run_all_without_any_leaks spawn_runner buf = timeout(10){@test_out.read} - assert_match(/^[SFE\.]{8}$/,buf) + assert_match(/^[SFE\.]{9}$/,buf) end def test_should_retry_failed_on_workers diff --git a/test/testunit/tests_for_parallel/ptest_forth.rb b/test/testunit/tests_for_parallel/ptest_forth.rb index ad5a7f34ce..46c88da519 100644 --- a/test/testunit/tests_for_parallel/ptest_forth.rb +++ b/test/testunit/tests_for_parallel/ptest_forth.rb @@ -15,6 +15,14 @@ class TestE < Test::Unit::TestCase assert_equal(0,1) end + def test_skip_after_unknown_error + begin + raise UnknownError, "unknown error" + rescue + skip "after raise" + end + end + def test_unknown_error raise UnknownError, "unknown error" end diff --git a/version.h b/version.h index 5c22b0d763..bb82cc0620 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-07-23" -#define RUBY_PATCHLEVEL 181 +#define RUBY_PATCHLEVEL 182 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 7