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.
This commit is contained in:
Vít Ondruch 2015-04-08 18:02:53 +02:00
parent 3de07540b7
commit 962179d29e
2 changed files with 78 additions and 2 deletions

View File

@ -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

View File

@ -39,6 +39,7 @@ Patch4: subversion-1.8.0-rubybind.patch
Patch8: subversion-1.8.5-swigplWall.patch Patch8: subversion-1.8.5-swigplWall.patch
Patch9: subversion-1.8.13-r1655262+.patch Patch9: subversion-1.8.13-r1655262+.patch
Patch10: subversion-1.8.13-swigpython.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: autoconf, libtool, python, python-devel, texinfo, which
BuildRequires: libdb-devel >= 4.1.25, swig >= 1.3.24, gettext BuildRequires: libdb-devel >= 4.1.25, swig >= 1.3.24, gettext
BuildRequires: apr-devel >= 1.3.0, apr-util-devel >= 1.3.0 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 Group: Development/Libraries
Summary: Ruby bindings to the Subversion libraries Summary: Ruby bindings to the Subversion libraries
BuildRequires: ruby-devel >= 1.9.1, ruby >= 1.9.1 BuildRequires: ruby-devel >= 1.9.1, ruby >= 1.9.1
# Test suite is broken with minitest 5 BuildRequires: rubygem(test-unit)
BuildRequires: rubygem(minitest) < 5
Requires: subversion%{?_isa} = %{version}-%{release} Requires: subversion%{?_isa} = %{version}-%{release}
Conflicts: ruby-libs%{?_isa} < 1.8.2 Conflicts: ruby-libs%{?_isa} < 1.8.2
@ -181,6 +181,7 @@ This package includes supplementary tools for use with Subversion.
%patch8 -p1 -b .swigplWall %patch8 -p1 -b .swigplWall
%patch9 -p1 -b .r1655262+ %patch9 -p1 -b .r1655262+
%patch10 -p1 -b .swigpython %patch10 -p1 -b .swigpython
%patch11 -p0 -b .ruby22-fixes
%build %build
# Regenerate the buildsystem, so that: # Regenerate the buildsystem, so that:
@ -470,6 +471,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif %endif
%changelog %changelog
* Wed Apr 08 2015 <vondruch@redhat.com> - 1.8.13-1
- Fix Ruby's test suite.
* Tue Apr 7 2015 Joe Orton <jorton@redhat.com> - 1.8.13-1 * Tue Apr 7 2015 Joe Orton <jorton@redhat.com> - 1.8.13-1
- update to 1.8.13 (#1207835) - update to 1.8.13 (#1207835)
- attempt to patch around SWIG issues - attempt to patch around SWIG issues