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

SQLite and the Ruby bindings tests on Windows

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: Mon, 8 Dec 2008 22:30:10 -0800

Hi,

I'm trying to find the best way to deal with the Ruby bindings test failures
I'm experiencing when running on Windows. I've seen comments on the list to
the effect that 4 or so tests are failing for others, but almost every test is
failing for me right now so I've been no help trying to trace anything down.

The following script using the Ruby bindings runs without a problem in r33729
on my WindowsXP system:

    require 'svn/repos'
    require 'svn/client'
    require 'fileutils'

    FileUtils.rmtree 'demo' if File.exist? 'demo'
    FileUtils.mkdir 'demo'

    wc_path = 'demo/wc'
    repos_path = 'demo/repos'
    repos_uri = "file:///#{File.expand_path(repos_path)}"
    file_path = "#{wc_path}/x.x"

    Svn::Repos.create(repos_path).close

    ctx = Svn::Client::Context.new
    ctx.set_log_msg_func { |items| [true, 'log msg'] }
    ctx.add_username_prompt_provider(0) {}
    ctx.auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = 'demo'

    ctx.checkout(repos_uri, wc_path)
    File.open(file_path, "w"){|f| f.print('content')}
    ctx.add(file_path)
    ctx.commit(wc_path)

    Svn::Repos.delete(repos_path)

But fails in r33743 (the first revision that would build for me after r33730)
with this message:

D:\SVN\src-trunk\subversion\bindings\swig\ruby>demo.rb
./svn/util.rb:86:in `svn_repos_delete': (Svn::Error::SvnError)
D:\SVN\src-trunk\subversion\libsvn_subr\io.c:1676: 720032: Can't
remove file 'demo\repos\db\rep-cache.db': The process cannot access
the file because it is being used by another process. from
./svn/util.rb:86:in `delete'
        from D:/SVN/src-trunk/subversion/bindings/swig/ruby/demo.rb:25

And a more current trunk (r34604) just moves this lines in the back trace:

D:\SVN\src-trunk\subversion\bindings\swig\ruby>demo.rb
./svn/util.rb:86:in `svn_repos_delete': (Svn::Error::SvnError)
D:\SVN\src-trunk\subversion\libsvn_subr\io.c:1740: 720032: Can't
remove file 'demo\repos\db\rep-cache.db': The process cannot access
the file because it is being used by another process. from
./svn/util.rb:86:in `delete'
        from D:/SVN/src-trunk/subversion/bindings/swig/ruby/demo.rb:25

I think this is because pool clean up that closes the cache doesn't run until
after the end of the script and windows doesn't allow deleting open files.

I can think of three solutions that basically boil down to: change SVN, change
the bindings, or change the bindings tests. To me they roughly correspond to:

1) The script above is correct and should be supported. In this case I think
it likely that the svn client code would have to change. Perhaps something
like the patch I attached in
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=94719
would be a start.

2) The script above is mostly correct and should be supported if the context
was closed in some way. In this case the bindings would have to change to
pass a different pool from the context object to the add and commit methods,
and a new method to close the context would be added which would destroy the
related pools. If this is the best solution, I hope that kou can help out
because the pool stuff is pretty opaque to me.

3) The script above is ridiculous because sane person would add or commit
(list might be another story, but don't let that ruin the sentiment) to a
repository they were about to delete (except maybe someone trying to test the
bindings). In this case I'm not sure what to do. The above script still
fails if the Svn::Repos.delete() is in an at_exit{} block. So maybe we'd have
to run each test in its own process? Ouch.

4) Give up on trying to support the Ruby bindings for a windows build.

Requesting opinions or suggestions,

--
Joe
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=981495
Received on 2008-12-09 07:30:31 CET

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.