Re: shelf-tests failure on macOS
From: Julian Foad <julianfoad_at_apache.org>
Date: Wed, 13 Jun 2018 15:31:09 +0100
Branko Čibej wrote:
I have been trying to reproduce and debug this with my colleague Konrad and we have a theory. The failure mode seems consistent with Python writing a change to disk and then running 'svn', and 'svn' not seeing that change on disk.
The test uses this code in svntest.main.file_write():
When opening and using a file object "in line" in this way, is seems that the timing of the implicit "close" is not specified, according to sources such as:
It seems that we need to change the code to something like:
def file_write(path, contents, mode='w'):
to guarantee the file is closed before the test proceeds further. It may be that most of our testing in the past has used Python implementations where the write is never delayed far enough to affect what an invoked 'svn' subprocess sees, but on the Mac it is a little different. We are using a Mac with Python 2. (The 'file_write' method has separate code paths for Python 2 and Python 3 but both use the same open().write() construct.)
The same construct appears in many other places in the test suite too.
We are trying to test this, and it is taking a long time because we can only currently reproduce the failure after a fresh checkout/build/test cycle. Maybe because the bug is sensitive to the differences in timing of a warm cache vs. a cold cache.
This is an archived mail posted to the Subversion Dev mailing list.