[PATCH] D34732: Clean temp directories before running lit

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 10:16:07 PDT 2017


rnk added inline comments.


================
Comment at: llvm/utils/lit/lit/run.py:254
+        # runs' output.
+        import time
+        start = time.time()
----------------
The time module is already available at global scope


================
Comment at: llvm/utils/lit/lit/run.py:260
+        clean_paths = list(clean_paths)
+        clean_paths.sort(key=lambda x: len(x.split(os.sep)))
+        for base in clean_paths:
----------------
Can you add a comment, something like "Sort the list by number of path components so that parent directories come before their children."


================
Comment at: llvm/utils/lit/lit/run.py:264
+                if not os.path.islink(base) and os.path.isdir(base):
+                    from shutil import rmtree
+                    rmtree(base, True)
----------------
Let's just import shutil at global scope and do shutil.rmtree.


================
Comment at: llvm/utils/lit/lit/run.py:271
+        end = time.time()
+        print("Cleanup took {} seconds".format(end - start))
+
----------------
Should we print this at all? If we decide we want it, should we print with litConfig.note()?


https://reviews.llvm.org/D34732





More information about the llvm-commits mailing list