[prev in list] [next in list] [prev in thread] [next in thread] 

List:       markus-dev
Subject:    Re: Tests on Windows (was: Stack level too deep?)
From:       Severin Gehwolf <severin.gehwolf () utoronto ! ca>
Date:       2010-05-06 10:52:50
Message-ID: 20100506065250.f07cs5fjcoccc884 () webmail ! utoronto ! ca
[Download RAW message or body]

Hi Evan,

First of thank you for invisting those hours to get MarkUs going on
Windows and updating our wiki page. Great job!

> I wrote the fix for my original problem and MarkUs works fine now.    
> There is a problem, however, with running the test cases, as Mike    
> mentioned.  The first couple of test cases pass, but then the rest    
> fail because they cannot create the repositories that they want to    
> create.  There is an IOError because the repository created in the    
> previous test case has not been deleted.
> 
> The repository is supposed to be deleted during teardown with the    
> command 'FileUtils.remove_dir(TEST_REPO, true)', but it is not    
> deleted because this function, although it does not raise an    
> exception, is unable to delete the directory.  If I manually execute  
> 'FileUtils.remove_dir(TEST_REPO)', it tells me that permission is   
> denied.  If I use Windows Explorer to delete the directory at this   
> point (with execution still paused), it tells me I cannot  delete    
> the folder because it is in use by another program.

You are talking about lib/repo/test/subversion_repository_test.rb, right?

> From this evidence and looking online it seems that this is caused    
> becase the test code has not properly closed the file handles on the  
> files it was using in the previous test case, and Windows does not  
> allow a file to be deleted if it is open.
> 
> Any ideas how to make ruby close the files properly?  I'm not sure    
> from looking at the code where the files are actually opened.

Hmm, good question. I think files are opened (but mabe never proberly  
closed) by the Ruby bindings only. Have a look at line 49 of
https://stanley.cdf.toronto.edu/drproject/csc49x/olm_rails/browser/trunk/lib/repo?file=subversion_repository.rb


There we do a Svn::Repos.open() (Svn::Repos are the Ruby bindings).  
Maybe there's an equivalent close() call or something similar. If  
there is something like that, we should probably implement a  
self.close and call it at appropriate places in our model classes  
(group.rb, admin.rb, ta.rb, etc.). Unfortunately, this would require  
more digging of the rather undocumented Ruby bindings.

It would be great if you feel like doing this. Maybe there's something  
like lsof for Windows to investigate which binary has those files  
open. It seems our only chance to fix this is to find those unclosed  
files and close them. This might be difficult, though.

See
http://stackoverflow.com/questions/15708/lsof-equivalent-for-windows
and
http://redmine.ruby-lang.org/issues/show/906

Good luck!

Severin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic