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)
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)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits