[llvm-lit] remove %t files before running a test
Tzafrir Poupko
tzafrir11 at gmail.com
Thu May 14 05:19:25 PDT 2015
Before running a test, purge all %t files used by previous tests.
Remove any custom file used in test which was prefixed by %t.
There are over 300 clang tests that run "rm -rf %t" as first run command,
this patch will make it automaticlly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150514/5b8b7ee9/attachment.html>
-------------- next part --------------
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index f4f72b2..8a52b7e 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -520,6 +520,8 @@ def _runShTest(test, litConfig, useExternalSh,
script, tmpBase, execdir):
# Create the output directory if it does not already exist.
lit.util.mkdir_p(os.path.dirname(tmpBase))
+ # Remove all temporary files relevant to this test if any exists
+ lit.util.purge(tmpBase + '.tmp')
if useExternalSh:
res = executeScript(test, litConfig, tmpBase, script, execdir)
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 08f7b71..efbdfa1 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -60,6 +60,11 @@ def mkdir_p(path):
if e.errno != errno.EEXIST:
raise
+def purge(path):
+ """purge(path) - Remove all files and folders starting with this path
+ prefix"""
+ subprocess.call(['rm','-rf',path+"*"])
+
def capture(args, env=None):
"""capture(command) - Run the given command (or argv list) in a shell and
return the standard output."""
More information about the llvm-commits
mailing list