Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: tools/isolate/trace_inputs.py

Issue 10381112: Add .clean_trace() to the APIs to delete the stale traces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/trace_inputs.py
diff --git a/tools/isolate/trace_inputs.py b/tools/isolate/trace_inputs.py
index 78918a6800c3e133f9c8cedb1df29131f2c47901..f49b8155b2250003fa389292bc0f822bc2cfe689 100755
--- a/tools/isolate/trace_inputs.py
+++ b/tools/isolate/trace_inputs.py
@@ -389,6 +389,12 @@ class Strace(object):
else:
self.non_existent.add(filepath)
+ @staticmethod
+ def clean_trace(logname):
+ """Deletes the old log."""
+ if os.path.isfile(logname):
+ os.remove(logname)
MAD 2012/05/11 18:51:38 Shouldn't we try to catch these? "On Windows, att
M-A Ruel 2012/05/11 18:57:25 I prefer the script to crash if the files can't be
+
@classmethod
def gen_trace(cls, cmd, cwd, logname, output):
"""Runs strace on an executable."""
@@ -699,6 +705,12 @@ class Dtrace(object):
def _handle_ignored(_ppid, pid, function, args, result):
logging.debug('%d %s(%s) = %s' % (pid, function, args, result))
+ @staticmethod
+ def clean_trace(logname):
+ """Deletes the old log."""
+ if os.path.isfile(logname):
+ os.remove(logname)
+
@classmethod
def gen_trace(cls, cmd, cwd, logname, output):
"""Runs dtrace on an executable."""
@@ -1013,6 +1025,14 @@ class LogmanTrace(object):
self.IGNORED.add('\\systemroot')
self.IGNORED = tuple(sorted(self.IGNORED))
+ @staticmethod
+ def clean_trace(logname):
+ """Deletes the old log."""
+ if os.path.isfile(logname):
+ os.remove(logname)
+ if os.path.isfile(logname + '.etl'):
+ os.remove(logname + '.etl')
+
@classmethod
def gen_trace(cls, cmd, cwd, logname, output):
logging.info('gen_trace(%s, %s, %s, %s)' % (cmd, cwd, logname, output))
@@ -1338,8 +1358,7 @@ def trace(logfile, cmd, cwd, api, output):
"""
cmd = fix_python_path(cmd)
assert os.path.isabs(cmd[0]), cmd[0]
- if os.path.isfile(logfile):
- os.remove(logfile)
+ api.clean_trace(logfile)
return api.gen_trace(cmd, cwd, logfile, output)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698