[Lldb-commits] [lldb] r298261 - Fix remote test suite directory creation

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 20 09:07:18 PDT 2017


Author: labath
Date: Mon Mar 20 11:07:17 2017
New Revision: 298261

URL: http://llvm.org/viewvc/llvm-project?rev=298261&view=rev
Log:
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.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/dotest.py
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=298261&r1=298260&r2=298261&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Mar 20 11:07:17 2017
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=298261&r1=298260&r2=298261&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Mar 20 11:07:17 2017
@@ -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.




More information about the lldb-commits mailing list