You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/03/26 14:14:49 UTC
svn commit: r1305323 -
/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
Author: julianfoad
Date: Mon Mar 26 12:14:49 2012
New Revision: 1305323
URL: http://svn.apache.org/viewvc?rev=1305323&view=rev
Log:
Fix some test suite bugs related to clean-up. These are mostly not causing
problems in normal test runs, but one problem seen by Danial Shahaf is that
since r1303316 some tests (e.g. export_tests 19,20) would fail if run
without cleanup afterwards and then run again. Another bug fixed here is
that some paths were not being cleaned up. Another potential bug fixed here
is that it was possible for a test to start using a WC path that still
existed from a previous test run if it didn't start by calling sbox.build().
Found by: danielsh
me
(danielsh: the bug exposed by export_tests 19,20 after a no-cleanup run;
me: the others)
* subversion/tests/cmdline/svntest/sandbox.py
(__init__): Initialize the list of paths to be cleaned up. Delete, create
and remember a directory for temporary files here ...
(get_tempname): ... instead of just creating it here if it didn't exist.
(_set_name): Don't reset the list of paths to be cleaned up, so we don't
lose any of them when we change the name of the sandbox. Ensure any
existing WC and repo directory is deleted.
Modified:
subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=1305323&r1=1305322&r2=1305323&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Mon Mar 26 12:14:49 2012
@@ -39,10 +39,16 @@ class Sandbox:
dependents = None
def __init__(self, module, idx):
+ self.test_paths = []
+
self._set_name("%s-%d" % (module, idx))
# This flag is set to True by build() and returned by is_built()
self._is_built = False
+ # Create an empty directory for temporary files
+ self.tmp_dir = self.add_wc_path('tmp', remove=True)
+ os.mkdir(self.tmp_dir)
+
def _set_name(self, name, read_only=False):
"""A convenience method for renaming a sandbox, useful when
working with multiple repositories in the same unit test."""
@@ -50,10 +56,12 @@ class Sandbox:
self.name = name
self.read_only = read_only
self.wc_dir = os.path.join(svntest.main.general_wc_dir, self.name)
+ self.add_test_path(self.wc_dir)
if not read_only:
self.repo_dir = os.path.join(svntest.main.general_repo_dir, self.name)
self.repo_url = (svntest.main.options.test_area_url + '/'
+ urllib.pathname2url(self.repo_dir))
+ self.add_test_path(self.repo_dir)
else:
self.repo_dir = svntest.main.pristine_greek_repos_dir
self.repo_url = svntest.main.pristine_greek_repos_url
@@ -77,8 +85,6 @@ class Sandbox:
elif self.repo_url.startswith("svn"):
self.authz_file = os.path.join(self.repo_dir, "conf", "authz")
- self.test_paths = [self.wc_dir, self.repo_dir]
-
def clone_dependent(self, copy_wc=False):
"""A convenience method for creating a near-duplicate of this
sandbox, useful when working with multiple repositories in the
@@ -151,13 +157,9 @@ class Sandbox:
"""Get a stable name for a temporary file that will be removed after
running the test"""
- dir = self.add_wc_path('tmp', remove=False)
- if not os.path.exists(dir):
- os.mkdir(dir)
-
self.tempname_offs = self.tempname_offs + 1
- return os.path.join(dir, '%s-%s' % (prefix, self.tempname_offs))
+ return os.path.join(self.tmp_dir, '%s-%s' % (prefix, self.tempname_offs))
def cleanup_test_paths(self):
"Clean up detritus from this sandbox, and any dependents."