forked from OSchip/llvm-project
Fix remote test suite directory creation
r298203 make SBPlatform::MakeDirectory less recursive, which breaks the test suite creation of test directory hierarchy creation on the remote target. Since the function was never fully recursive, and the name does not imply recursiveness, I fix the problem by modifying the test runner to do the recursion manually. I also make the runner complain more loudly when it fails to create the directory -- previously it just printed the error to stdout and caused most of the tests to hang, which is not very helpful in diagnosing the problem. llvm-svn: 298261
This commit is contained in:
parent
5d59a4ee19
commit
6b42b3b7a3
|
@ -1147,8 +1147,15 @@ def run_suite():
|
|||
if configuration.lldb_platform_working_dir:
|
||||
print("Setting remote platform working directory to '%s'..." %
|
||||
(configuration.lldb_platform_working_dir))
|
||||
lldb.remote_platform.SetWorkingDirectory(
|
||||
configuration.lldb_platform_working_dir)
|
||||
error = lldb.remote_platform.MakeDirectory(
|
||||
configuration.lldb_platform_working_dir, 448) # 448 = 0o700
|
||||
if error.Fail():
|
||||
raise Exception("making remote directory '%s': %s" % (
|
||||
remote_test_dir, error))
|
||||
|
||||
if not lldb.remote_platform.SetWorkingDirectory(
|
||||
configuration.lldb_platform_working_dir):
|
||||
raise Exception("failed to set working directory '%s'" % remote_test_dir)
|
||||
lldb.DBG.SetSelectedPlatform(lldb.remote_platform)
|
||||
else:
|
||||
lldb.remote_platform = None
|
||||
|
|
|
@ -692,31 +692,30 @@ class Base(unittest2.TestCase):
|
|||
if not lldb.remote_platform or not configuration.lldb_platform_working_dir:
|
||||
return
|
||||
|
||||
remote_test_dir = lldbutil.join_remote_paths(
|
||||
configuration.lldb_platform_working_dir,
|
||||
self.getArchitecture(),
|
||||
str(self.test_number),
|
||||
self.mydir)
|
||||
error = lldb.remote_platform.MakeDirectory(
|
||||
remote_test_dir, 448) # 448 = 0o700
|
||||
if error.Success():
|
||||
lldb.remote_platform.SetWorkingDirectory(remote_test_dir)
|
||||
components = [str(self.test_number)] + self.mydir.split(os.path.sep)
|
||||
remote_test_dir = configuration.lldb_platform_working_dir
|
||||
for c in components:
|
||||
remote_test_dir = lldbutil.join_remote_paths(remote_test_dir, c)
|
||||
error = lldb.remote_platform.MakeDirectory(
|
||||
remote_test_dir, 448) # 448 = 0o700
|
||||
if error.Fail():
|
||||
raise Exception("making remote directory '%s': %s" % (
|
||||
remote_test_dir, error))
|
||||
|
||||
# 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: 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(clean_working_directory)
|
||||
else:
|
||||
print("error: making remote directory '%s': %s" % (
|
||||
remote_test_dir, error))
|
||||
lldb.remote_platform.SetWorkingDirectory(remote_test_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: 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(clean_working_directory)
|
||||
|
||||
def setUp(self):
|
||||
"""Fixture for unittest test case setup.
|
||||
|
|
Loading…
Reference in New Issue