testing bzr under Wine

Martin Pool mbp at canonical.com
Sat Aug 15 03:18:56 BST 2009


2009/8/14 John Arbash Meinel <john at arbash-meinel.com>:
> So the #1 question is whether it preserves all of the Windows behaviors
> about files even under linux. For example:
>  1) Can you rename/delete an open file?

Apparently it is consistent with Windows, which is great:

mbp at lithe% winepython
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'Z:\\home\\mbp'
>>> f = file('tmp/test', 'wt')
>>> os.unlink('tmp/test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 32] Sharing violation: 'tmp/test'

It even works if you open it from one wine process and try to delete
it from the other.  It doesn't stop you deleting it from Unix, and I'm
not sure it should.

So at any rate at least on this point, we should get consistent results.

>  2) Can you rename the directory when you have a file inside it held
>     open?

Unfortunately yes:

>>> os.mkdir('tmp/a')
>>> f = file('tmp/a/test','wt')
>>> os.rename('tmp/a', 'tmp/b')
>>> f
<open file 'tmp/a/test', mode 'wt' at 0x005FF160>

>  3) Is a read lock exclusive with a write lock inside the same process?

I'm not sure how to quickly test this.  I would guess yes.

>
> Those are the primary source of windows failures at the moment. I'm
> going to try to submit my locking warnings (it got blocked yesterday by
> Launchpad having problems).

The ssh server was down because of a bad rollout for a while.

> There is also the:
>  4) Can you overwrite a file by renaming over it. (and can you do it
>     when the file is already open.)
>
> If these all hold true, then it does seem like wine would be sufficient
> for running the test suite.

We could write a plugin that enforces at least the in-process
constraints here even on Linux.

So it looks like it won't give total assurance, and it might give some
false results, but it might get us a bit closer.  I don't think it
would be enough to only run the tests there, but we might be able to
run some tests of things that seems relevant and catch some bugs a bit
earlier.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list