vondruch pushed to subversion (master). "Fix Ruby's test suite. (..more)"

notifications at fedoraproject.org notifications at fedoraproject.org
Thu Apr 9 05:13:41 UTC 2015


>From 962179d29e236af02aaec7c97ca1848da0edd6ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch at redhat.com>
Date: Wed, 8 Apr 2015 18:02:53 +0200
Subject: Fix Ruby's test suite.

Please note that the test suite was adjusted to work with test-unit as
well as test-unit wrapper (which uses Minitest in background) as
provided by Ruby < 2.2.

Some tips were provided by original author of Ruby bindings and
test-unit maintainer in one person
(https://github.com/test-unit/test-unit/issues/99#issuecomment-90532326).
I did not followed all, since I think that as long as RHEL 6 is
maintained, we might need Ruby 1.8.7 support.

diff --git a/subversion-1.8.11-ruby22-fixes.rb b/subversion-1.8.11-ruby22-fixes.rb
new file mode 100644
index 0000000..fbb0275
--- /dev/null
+++ b/subversion-1.8.11-ruby22-fixes.rb
@@ -0,0 +1,72 @@
+Index: subversion/bindings/swig/ruby/test/my-assertions.rb
+===================================================================
+--- subversion/bindings/swig/ruby/test/my-assertions.rb	(revision 1671099)
++++ subversion/bindings/swig/ruby/test/my-assertions.rb	(working copy)
+@@ -27,9 +27,7 @@
+       # make an intermediary assertion block handler
+       def _my_assert_block(&block)
+        if RUBY_VERSION > '1.9'
+-         assert_block do
+-           yield
+-         end
++         yield
+        else
+          _wrap_assertion do
+            yield
+Index: subversion/bindings/swig/ruby/test/test-unit-ext.rb
+===================================================================
+--- subversion/bindings/swig/ruby/test/test-unit-ext.rb	(revision 1671099)
++++ subversion/bindings/swig/ruby/test/test-unit-ext.rb	(working copy)
+@@ -18,6 +18,6 @@
+ # ====================================================================
+ 
+ require "test-unit-ext/always-show-result" if RUBY_VERSION < '1.9.3'
+-require "test-unit-ext/priority"
++require "test-unit-ext/priority" if defined? MiniTest or defined? Minitest
+ require "test-unit-ext/backtrace-filter" if RUBY_VERSION < '1.9.3'
+ require "test-unit-ext/long-display-for-emacs" if RUBY_VERSION < '1.9.3'
+Index: subversion/bindings/swig/ruby/test/test_repos.rb
+===================================================================
+--- subversion/bindings/swig/ruby/test/test_repos.rb	(revision 1671099)
++++ subversion/bindings/swig/ruby/test/test_repos.rb	(working copy)
+@@ -679,7 +679,7 @@
+       dest_path = File.join(@tmp_path, "dest")
+       Svn::Repos.create(dest_path) do |repos|
+         assert_raises(NoMethodError) do
+-          repos.load_fs(nil)
++          repos.load_fs(Object.new)
+         end
+       end
+ 
+Index: subversion/bindings/swig/ruby/test/test_wc.rb
+===================================================================
+--- subversion/bindings/swig/ruby/test/test_wc.rb	(revision 1671099)
++++ subversion/bindings/swig/ruby/test/test_wc.rb	(working copy)
+@@ -411,7 +411,7 @@
+     end
+   end
+ 
+-  def test_status
++  def test_status2
+     source = "source"
+     file1 = "file1"
+     file2 = "file2"
+@@ -540,7 +540,6 @@
+           result = yield(access.send(*args), source)
+           result ||= File.open(src_path, "rb") {|f| f.read}
+           assert_equal(crlf_source, result)
+-
+           File.open(src_path, "wb") {|f| f.print(source)}
+           args = [method_name, src_path, cr_path, Svn::Wc::TRANSLATE_FROM_NF]
+           result = yield(access.send(*args), source)
+@@ -1072,8 +1071,8 @@
+         assert_not_nil context
+         assert_kind_of Svn::Wc::Context, context
+       end
+-      if RUBY_VERSION > '1.9'
+-        assert_equal(result,true)
++      if defined? MiniTest or defined? Minitest
++        assert_equal(true, result)
+       else
+         assert_nil result
+       end
diff --git a/subversion.spec b/subversion.spec
index 07df5ab..705b304 100644
--- a/subversion.spec
+++ b/subversion.spec
@@ -39,6 +39,7 @@ Patch4: subversion-1.8.0-rubybind.patch
 Patch8: subversion-1.8.5-swigplWall.patch
 Patch9: subversion-1.8.13-r1655262+.patch
 Patch10: subversion-1.8.13-swigpython.patch
+Patch11: subversion-1.8.11-ruby22-fixes.rb
 BuildRequires: autoconf, libtool, python, python-devel, texinfo, which
 BuildRequires: libdb-devel >= 4.1.25, swig >= 1.3.24, gettext
 BuildRequires: apr-devel >= 1.3.0, apr-util-devel >= 1.3.0
@@ -156,8 +157,7 @@ This package includes the JNI bindings to the Subversion libraries.
 Group: Development/Libraries
 Summary: Ruby bindings to the Subversion libraries
 BuildRequires: ruby-devel >= 1.9.1, ruby >= 1.9.1
-# Test suite is broken with minitest 5
-BuildRequires: rubygem(minitest) < 5
+BuildRequires: rubygem(test-unit)
 Requires: subversion%{?_isa} = %{version}-%{release}
 Conflicts: ruby-libs%{?_isa} < 1.8.2
 
@@ -181,6 +181,7 @@ This package includes supplementary tools for use with Subversion.
 %patch8 -p1 -b .swigplWall
 %patch9 -p1 -b .r1655262+
 %patch10 -p1 -b .swigpython
+%patch11 -p0 -b .ruby22-fixes
 
 %build
 # Regenerate the buildsystem, so that:
@@ -470,6 +471,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %endif
 
 %changelog
+* Wed Apr 08 2015 <vondruch at redhat.com> - 1.8.13-1
+- Fix Ruby's test suite.
+
 * Tue Apr  7 2015 Joe Orton <jorton at redhat.com> - 1.8.13-1
 - update to 1.8.13 (#1207835)
 - attempt to patch around SWIG issues
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/subversion.git/commit/?h=master&id=962179d29e236af02aaec7c97ca1848da0edd6ae


More information about the scm-commits mailing list