diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 20:44:35 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 20:44:35 +0000 |
commit | 238198d67c2c5cf9b411451dee7177b31af27ae9 (patch) | |
tree | 3f164a17d28d1691669d03395770bf19e615adf3 | |
parent | 0c419551acb73f5c1c1108fbea1787a511342e66 (diff) | |
download | chromium_src-238198d67c2c5cf9b411451dee7177b31af27ae9.zip chromium_src-238198d67c2c5cf9b411451dee7177b31af27ae9.tar.gz chromium_src-238198d67c2c5cf9b411451dee7177b31af27ae9.tar.bz2 |
Add .clean_trace() to the APIs to delete the stale traces.
It'll become soon more complex for strace so it's preferable to have a proper
interface.
R=mad@chromium.org
BUG=98636
TEST=
Review URL: https://chromiumcodereview.appspot.com/10381112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136655 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/isolate/trace_inputs.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/isolate/trace_inputs.py b/tools/isolate/trace_inputs.py index 78918a6..f49b815 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) + @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) |