| OLD | NEW |
| 1 #!/bin/env python | 1 #!/bin/env python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # common.py | 6 # common.py |
| 7 | 7 |
| 8 """ Common code used by purify_test.py and quantify_test.py in order to automate | 8 """ Common code used by purify_test.py and quantify_test.py in order to automate |
| 9 running of Rational Purify and Quantify in a consistent manner. | 9 running of Rational Purify and Quantify in a consistent manner. |
| 10 """ | 10 """ |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 logging.info("starting execution...") | 275 logging.info("starting execution...") |
| 276 # note that self._args begins with the exe to be run | 276 # note that self._args begins with the exe to be run |
| 277 proc += self._args | 277 proc += self._args |
| 278 if RunSubprocess(proc, self._timeout) == 0: | 278 if RunSubprocess(proc, self._timeout) == 0: |
| 279 return True | 279 return True |
| 280 return False | 280 return False |
| 281 | 281 |
| 282 def Analyze(self): | 282 def Analyze(self): |
| 283 '''Analyze step after a successful Execution. Should be overridden | 283 '''Analyze step after a successful Execution. Should be overridden |
| 284 by the subclasser if instrumentation is desired. | 284 by the subclasser if instrumentation is desired. |
| 285 Returns 0 for success, -88 for warning (see ReturnCodeCommand) and anything | 285 Returns 0 for success, 88 for warning (see ReturnCodeCommand) and anything |
| 286 else for error | 286 else for error |
| 287 ''' | 287 ''' |
| 288 return -1 | 288 return -1 |
| 289 | 289 |
| 290 def ParseArgv(self): | 290 def ParseArgv(self): |
| 291 '''Parses arguments according to CreateOptionParser | 291 '''Parses arguments according to CreateOptionParser |
| 292 Subclassers must override if they have extra arguments.''' | 292 Subclassers must override if they have extra arguments.''' |
| 293 self.CreateOptionParser() | 293 self.CreateOptionParser() |
| 294 self._options, self._args = self._parser.parse_args() | 294 self._options, self._args = self._parser.parse_args() |
| 295 if self._options.verbose: | 295 if self._options.verbose: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 logging.info("clearing instrumentation cache %s" % self._cache_dir) | 333 logging.info("clearing instrumentation cache %s" % self._cache_dir) |
| 334 if os.path.isdir(self._cache_dir): | 334 if os.path.isdir(self._cache_dir): |
| 335 for cfile in os.listdir(self._cache_dir): | 335 for cfile in os.listdir(self._cache_dir): |
| 336 file = os.path.join(self._cache_dir, cfile) | 336 file = os.path.join(self._cache_dir, cfile) |
| 337 if os.path.isfile(file): | 337 if os.path.isfile(file): |
| 338 try: | 338 try: |
| 339 os.remove(file) | 339 os.remove(file) |
| 340 except: | 340 except: |
| 341 logging.warning("unable to delete file %s: %s" % (file, | 341 logging.warning("unable to delete file %s: %s" % (file, |
| 342 sys.exc_info()[0])) | 342 sys.exc_info()[0])) |
| OLD | NEW |