diff options
author | mcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 23:18:24 +0000 |
---|---|---|
committer | mcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 23:18:24 +0000 |
commit | e4f373ea76ab139f690cf6b631e7e3b96ad0b7b8 (patch) | |
tree | 4ee91b7e8461b12840433b6d4d6fd3aadc7204ea /ppapi/PRESUBMIT.py | |
parent | 732b813ab60ebaad3cd2a60e19154e2c29b5a144 (diff) | |
download | chromium_src-e4f373ea76ab139f690cf6b631e7e3b96ad0b7b8.zip chromium_src-e4f373ea76ab139f690cf6b631e7e3b96ad0b7b8.tar.gz chromium_src-e4f373ea76ab139f690cf6b631e7e3b96ad0b7b8.tar.bz2 |
ppapi: Add presubmit check for .srpc file changes
If someone changes a .srpc file, they must include the regenerated
files from srpcgen in the same commit.
BUG= none
TEST= none
R=noelallen@google.com,noelallen@chromium.org
Review URL: http://codereview.chromium.org/9152017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/PRESUBMIT.py')
-rw-r--r-- | ppapi/PRESUBMIT.py | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/ppapi/PRESUBMIT.py b/ppapi/PRESUBMIT.py index 227cc41..3e0f963 100644 --- a/ppapi/PRESUBMIT.py +++ b/ppapi/PRESUBMIT.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -6,9 +6,9 @@ import os import sys import subprocess -def RunCmdAndCheck(cmd, ppapi_dir, err_string, output_api): +def RunCmdAndCheck(cmd, err_string, output_api, cwd=None): results = [] - p = subprocess.Popen(cmd, cwd=os.path.join(ppapi_dir, 'generators'), + p = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (p_stdout, p_stderr) = p.communicate() @@ -32,15 +32,31 @@ def RunUnittests(input_api, output_api): cmd = [ sys.executable, 'idl_gen_pnacl.py', '--wnone', '--test'] ppapi_dir = input_api.PresubmitLocalPath() results.extend(RunCmdAndCheck(cmd, - ppapi_dir, 'PPAPI IDL Pnacl unittest failed.', - output_api)) + output_api, + os.path.join(ppapi_dir, 'generators'))) return results +# If any .srpc files were changed, run run_srpcgen.py --diff_mode. +def CheckSrpcChange(input_api, output_api): + if [True for filename in input_api.LocalPaths() if + os.path.splitext(filename)[1] == '.srpc']: + return RunCmdAndCheck([sys.executable, + os.path.join(input_api.PresubmitLocalPath(), + 'native_client', 'src', + 'shared', 'ppapi_proxy', + 'run_srpcgen.py'), + '--diff_mode'], + 'PPAPI SRPC Diff detected: Run run_srpcgen.py.', + output_api) + return [] + def CheckChange(input_api, output_api): results = [] + results.extend(CheckSrpcChange(input_api, output_api)) + results.extend(RunUnittests(input_api, output_api)) # Verify all modified *.idl have a matching *.h @@ -86,9 +102,9 @@ def CheckChange(input_api, output_api): # Only generate output for IDL files references (as *.h or *.idl) in this CL cmd.append('--out=' + ','.join([name + '.idl' for name in both])) results.extend(RunCmdAndCheck(cmd, - ppapi_dir, 'PPAPI IDL Diff detected: Run the generator.', - output_api)) + output_api, + os.path.join(ppapi_dir, 'generators'))) return results def CheckChangeOnUpload(input_api, output_api): |