From 11db2d3dddd704601893adc8a6517a8f9040a384 Mon Sep 17 00:00:00 2001 From: Tamas Berghammer Date: Wed, 7 Oct 2015 14:52:16 +0000 Subject: [PATCH] Fix race condition in the working directory cleanup code llvm-svn: 249549 --- lldb/test/lldbtest.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index b3bb23fca0e1..efb678e22f38 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -2473,12 +2473,17 @@ class TestBase(Base): if error.Success(): lldb.remote_platform.SetWorkingDirectory(remote_test_dir) - def remove_working_dir(): + # This function removes all files from the current working directory while leaving + # the directories in place. The cleaup is required to reduce the disk space required + # by the test suit while leaving the directories untached is neccessary because + # sub-directories might belong to an other test + def clean_working_directory(): # TODO: Make it working on Windows when we need it for remote debugging support - # TODO: Add a command to SBPlatform/Platform to remove a (non empty) directory - shell_cmd = lldb.SBPlatformShellCommand("rm -rf %s" % remote_test_dir) + # TODO: Replace the heuristic to remove the files with a logic what collects the + # list of files we have to remove during test runs. + shell_cmd = lldb.SBPlatformShellCommand("rm %s/*" % remote_test_dir) lldb.remote_platform.Run(shell_cmd) - self.addTearDownHook(remove_working_dir) + self.addTearDownHook(clean_working_directory) else: print "error: making remote directory '%s': %s" % (remote_test_dir, error)