[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH 2/2] run ruby tests out-of-tree

From: Peter Samuelson <peter_at_p12n.org>
Date: Fri, 20 Jun 2008 21:19:48 -0500

[Peter Samuelson]
> This is needed in order to run the ruby tests out-of-tree. But it
> apparently breaks some assumptions in a few of the tests.

> 1) Failure:
> test_copy(SvnClientTest) [{SRC_DIR}/subversion/bindings/swig/ruby/test/test_client.rb:1170]:
> <["../../../../../subversion/bindings/swig/ruby/test/wc-tmp/wc/sample2.txt"]> expected but was
> <["subversion/bindings/swig/ruby/test/wc-tmp/wc/sample2.txt"]>.

So, the problem is that the ruby tests set up a working copy in
"../../../../../subversion/bindings/swig/ruby/test/wc-tmp/wc", then
test the notify callback on a commit. The wc notifier helpfully strips
off the leading "../../../../../". Several of the ruby tests compare
the callback path with the original path, which of course fails.

This raises the question: why do the ruby tests put their temp files in
the _source_ directory, anyway? Why not just in the current directory?
Here is my fix.

[[[
In the ruby testsuite, create temporary directories in the build tree,
not in the source tree. This avoids failures caused by the fact that
relative wc paths ("../../../../../subversion/bindings/swig/etc.") are
partially stripped ("subversion/bindings/swig/etc.") when passed to
svn_wc_notify_func2.

[In subversion/bindings/swig/ruby/test]

* util.rb (setup_default_variables): Eliminate @base_dir; anchor all
    temporary files in the current dir rather than the source dir.

* windows_util.rb (setup_svnserve): Move svnserve temp dir likewise.

Patch by: Peter Samuelson <peter_at_p12n.org>
]]]

--- a/subversion/bindings/swig/ruby/test/util.rb
+++ b/subversion/bindings/swig/ruby/test/util.rb
@@ -15,20 +15,19 @@
   def setup_default_variables
     test_dir = Pathname.new(File.dirname(__FILE__))
     pwd = Pathname.new(Dir.pwd)
- @base_dir = test_dir.relative_path_from(pwd).to_s
     @author = ENV["USER"] || "sample-user"
     @password = "sample-password"
     @realm = "sample realm"
- @repos_path = File.join(@base_dir, "repos")
+ @repos_path = "repos"
     @full_repos_path = File.expand_path(@repos_path)
     @repos_uri = "file://#{@full_repos_path.sub(/^\/?/, '/')}"
     @svnserve_host = "127.0.0.1"
     @svnserve_ports = (64152..64282).collect{|x| x.to_s}
- @wc_base_dir = File.join(@base_dir, "wc-tmp")
+ @wc_base_dir = "wc-tmp"
     @wc_path = File.join(@wc_base_dir, "wc")
     @full_wc_path = File.expand_path(@wc_path)
- @tmp_path = File.join(@base_dir, "tmp")
- @config_path = File.join(@base_dir, "config")
+ @tmp_path = "tmp"
+ @config_path = "config"
     @greek = Greek.new(@tmp_path, @wc_path, @repos_uri)
   end
 
--- a/subversion/bindings/swig/ruby/test/windows_util.rb
+++ b/subversion/bindings/swig/ruby/test/windows_util.rb
@@ -53,7 +53,7 @@
           service_control('stop') unless service_stopped?
           service_control('delete') if service_exists?
 
- svnserve_dir = File.expand_path(File.join(@base_dir, "svnserve"))
+ svnserve_dir = File.expand_path("svnserve")
           FileUtils.mkdir_p(svnserve_dir)
           at_exit do
             service_control('stop') unless service_stopped?

Received on 2008-06-21 04:20:05 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.