[Lldb-commits] [PATCH] D44680: [dotest] Remove test build directories for passing tests

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 20 05:08:03 PDT 2018


labath created this revision.
labath added reviewers: aprantl, clayborg.

This logic is hooked into the same mechanism as the deletion of log
files, which makes it possible to use the --log-success argument to have
dotest keep the files around (for comparative analysis or whatever).

This makes the --log-successs option slightly misnamed. However one
could argue that the contents of the build folder represents a "log" of
the test's execution, so I chose to to rename it.


https://reviews.llvm.org/D44680

Files:
  packages/Python/lldbsuite/test/lldbtest.py


Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -705,11 +705,13 @@
     def makeBuildDir(self):
         """Create the test-specific working directory, deleting any previous
         contents."""
-        # See also dotest.py which sets up ${LLDB_BUILD}.
+        self.cleanBuildDir()
+        lldbutil.mkdir_p(self.getBuildDir())
+
+    def cleanBuildDir(self):
         bdir = self.getBuildDir()
         if os.path.isdir(bdir):
             shutil.rmtree(bdir)
-        lldbutil.mkdir_p(bdir)
  
     def getBuildArtifact(self, name="a.out"):
         """Return absolute path to an artifact in the test's build directory."""
@@ -1206,7 +1208,7 @@
         log_files_for_this_test = glob.glob(self.log_basename + "*")
 
         if prefix != 'Success' or lldbtest_config.log_success:
-            # keep all log files, rename them to include prefix
+            # keep all test artifacts, rename log files to include prefix
             dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
             for src in log_files_for_this_test:
                 if os.path.isfile(src):
@@ -1220,7 +1222,9 @@
 
                     os.rename(src, dst)
         else:
-            # success!  (and we don't want log files) delete log files
+            # success!  (and we don't want any artifacts): delete log files and
+            # nuke the build dir.
+            self.cleanBuildDir()
             for log_file in log_files_for_this_test:
                 remove_file(log_file)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44680.139108.patch
Type: text/x-patch
Size: 1654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180320/3140fd9f/attachment.bin>


More information about the lldb-commits mailing list