You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/06/19 06:00:38 UTC

svn commit: r1494439 - in /subversion/branches/1.8.x: ./ STATUS subversion/bindings/swig/ruby/test/util.rb

Author: svn-role
Date: Wed Jun 19 04:00:38 2013
New Revision: 1494439

URL: http://svn.apache.org/r1494439
Log:
Merge r1492295 from trunk:

 * r1492295
   Fix swig-rb tests with out-of-tree builds.
   Justification:
     Our tests should not be broken, regression in 1.8.0 from previous versions
   Votes:
     +1: breser
     +0: danielsh

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/bindings/swig/ruby/test/util.rb

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1492295

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1494439&r1=1494438&r2=1494439&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Wed Jun 19 04:00:38 2013
@@ -223,14 +223,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1492295
-   Fix swig-rb tests with out-of-tree builds.
-   Justification:
-     Our tests should not be broken, regression in 1.8.0 from previous versions
-   Votes:
-     +1: breser
-     +0: danielsh
-
  * r1492164
    Invalid repository paths cause a segfault in the fsfs-stats tool.
    Justification:

Modified: subversion/branches/1.8.x/subversion/bindings/swig/ruby/test/util.rb
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/bindings/swig/ruby/test/util.rb?rev=1494439&r1=1494438&r2=1494439&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/bindings/swig/ruby/test/util.rb (original)
+++ subversion/branches/1.8.x/subversion/bindings/swig/ruby/test/util.rb Wed Jun 19 04:00:38 2013
@@ -19,7 +19,41 @@
 
 require "fileutils"
 require "pathname"
-require "./svn/util"
+
+# Tale of a hack...
+#
+# Here we are, %SVN-WC-ROOT%/subversion/bindings/swig/ruby/test/util.rb,
+# trying to require %SVN-WC-ROOT%/subversion/bindings/swig/ruby/svn/util.rb,
+# all the while supporting both Ruby 1.8 and 1.9.  Simply using this,
+#
+#   require "svn/util"
+#
+# works for Ruby 1.8 if the CWD is subversion/bindings/swig/ruby
+# when we are running the tests, e.g.:
+#
+#   %SVN-WC-ROOT%/subversion/bindings/swig/ruby>ruby test\run-test.rb
+#
+# This is because the CWD is included in the load path when Ruby 1.8
+# searches for required files.  But this doesn't work for Ruby 1.9,
+# which doesn't include the CWD this way, so instead we could use this:
+#
+#   require "./svn/util"
+#
+# But that only works if ./svn/util is relative to the CWD (again if the
+# CWD is %SVN-WC-ROOT%/subversion/bindings/swig/ruby).  However, if we run
+# the tests from a different CWD and specify
+# %SVN-WC-ROOT%/subversion/bindings/swig/ruby as an additional $LOAD_PATH
+# using the ruby -I option, then that fails on both 1.8 and 1.9 with a
+# LoadError.
+#
+# The usual solution in a case like this is to use require_relative,
+#
+#  require_relative "../svn/util"
+#
+# But that's only available in Ruby 1.9.  We could require the backports gem
+# but there is a simple workaround, just calculate the full path of util:
+require File.join(File.dirname(__FILE__), '../svn/util')
+
 require "tmpdir"
 
 require "my-assertions"