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

Re: Errors in test framework cleanup

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Sun, 12 Oct 2008 17:09:07 +0100

Bert Huijben wrote:
> If you have some time, could you please look at why the test cleanup code
> (as enabled when passing -c from win-tests.py) fails, this shows as a failed
> test?

Hi Bert. I don't have Windows, but if you show me/us exactly what goes
wrong, I/we might be able to help. I don't exactly have spare time, but
I could always make time for a quick look.

Is this mail thread describing the problem you see?
<http://svn.haxx.se/users/archive-2007-01/0022.shtml> In that thread,
David James ends by saying the problems should be fixed.

I guess if there's still a problem with clean-up, it must be in
safe_rmtree() in subversion/tests/cmdline/svntest/main.py:

[[[
# Chmod recursively on a whole subtree
def chmod_tree(path, mode, mask):
  def visit(arg, dirname, names):
    mode, mask = arg
    for name in names:
      fullname = os.path.join(dirname, name)
      if not os.path.islink(fullname):
        new_mode = (os.stat(fullname)[stat.ST_MODE] & ~mask) | mode
        os.chmod(fullname, new_mode)
  os.path.walk(path, visit, (mode, mask))

# For clearing away working copies
def safe_rmtree(dirname, retry=0):
  "Remove the tree at DIRNAME, making it writable first"
  def rmtree(dirname):
    chmod_tree(dirname, 0666, 0666)
    shutil.rmtree(dirname)

  if not os.path.exists(dirname):
    return

  if retry:
    for delay in (0.5, 1, 2, 4):
      try:
        rmtree(dirname)
        break
      except:
        time.sleep(delay)
    else:
      rmtree(dirname)
  else:
    rmtree(dirname)
]]]

This looks fairly Unix-specific, and I don't know if it is intended to
work on Windows too. The mail thread above indicated that
"shutil.rmtree" should not be used on Windows.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-12 18:09:26 CEST

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.