Send a crash report when a hung process is detected.
[chromium-blink-merge.git] / tools / telemetry / PRESUBMIT.py
blob89909f148eb0811afa4b8d75e0c59c4a63f0e93b
1 # Copyright 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import os
5 import sys
8 def _CommonChecks(input_api, output_api):
9 results = []
11 # TODO(nduca): This should call update_docs.IsUpdateDocsNeeded().
12 # Disabled due to crbug.com/255326.
13 if False:
14 update_docs_path = os.path.join(
15 input_api.PresubmitLocalPath(), 'update_docs')
16 assert os.path.exists(update_docs_path)
17 results.append(output_api.PresubmitError(
18 'Docs are stale. Please run:\n' +
19 '$ %s' % os.path.abspath(update_docs_path)))
21 results.extend(input_api.canned_checks.RunPylint(
22 input_api, output_api, black_list=[], pylintrc='pylintrc'))
23 return results
25 def GetPathsToPrepend(input_api):
26 return [input_api.PresubmitLocalPath(),
27 os.path.join(input_api.PresubmitLocalPath(), os.path.pardir,
28 os.path.pardir, 'third_party', 'typ')]
30 def RunWithPrependedPath(prepended_path, fn, *args):
31 old_path = sys.path
33 try:
34 sys.path = prepended_path + old_path
35 return fn(*args)
36 finally:
37 sys.path = old_path
39 def CheckChangeOnUpload(input_api, output_api):
40 def go():
41 results = []
42 results.extend(_CommonChecks(input_api, output_api))
43 return results
44 return RunWithPrependedPath(GetPathsToPrepend(input_api), go)
46 def CheckChangeOnCommit(input_api, output_api):
47 def go():
48 results = []
49 results.extend(_CommonChecks(input_api, output_api))
50 return results
51 return RunWithPrependedPath(GetPathsToPrepend(input_api), go)