diff options
Diffstat (limited to 'chromium/v8/tools/presubmit.py')
-rwxr-xr-x | chromium/v8/tools/presubmit.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/chromium/v8/tools/presubmit.py b/chromium/v8/tools/presubmit.py index 56eac8ecea4..518f2d90746 100755 --- a/chromium/v8/tools/presubmit.py +++ b/chromium/v8/tools/presubmit.py @@ -144,8 +144,8 @@ class FileContentsCache(object): try: sums_file = open(self.sums_file_name, 'r') self.sums = pickle.load(sums_file) - except IOError: - # File might not exist, this is OK. + except: + # Cannot parse pickle for any reason. Not much we can do about it. pass finally: if sums_file: @@ -155,6 +155,14 @@ class FileContentsCache(object): try: sums_file = open(self.sums_file_name, 'w') pickle.dump(self.sums, sums_file) + except: + # Failed to write pickle. Try to clean-up behind us. + if sums_file: + sums_file.close() + try: + os.unlink(self.sums_file_name) + except: + pass finally: sums_file.close() @@ -192,7 +200,7 @@ class SourceFileProcessor(object): def IgnoreDir(self, name): return (name.startswith('.') or - name in ('data', 'kraken', 'octane', 'sunspider')) + name in ('buildtools', 'data', 'kraken', 'octane', 'sunspider')) def IgnoreFile(self, name): return name.startswith('.') @@ -297,7 +305,8 @@ class SourceProcessor(SourceFileProcessor): if self.IgnoreDir(dir_part): break else: - if self.IsRelevant(file) and not self.IgnoreFile(file): + if (self.IsRelevant(file) and os.path.exists(file) + and not self.IgnoreFile(file)): result.append(join(path, file)) if output.wait() == 0: return result @@ -407,6 +416,13 @@ class SourceProcessor(SourceFileProcessor): return success +def CheckGeneratedRuntimeTests(workspace): + code = subprocess.call( + [sys.executable, join(workspace, "tools", "generate-runtime-tests.py"), + "check"]) + return code == 0 + + def GetOptions(): result = optparse.OptionParser() result.add_option('--no-lint', help="Do not run cpplint", default=False, @@ -425,6 +441,7 @@ def Main(): print "Running copyright header, trailing whitespaces and " \ "two empty lines between declarations check..." success = SourceProcessor().Run(workspace) and success + success = CheckGeneratedRuntimeTests(workspace) and success if success: return 0 else: |