1 # Copyright (c) 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 """ 5 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 6 for more details on the presubmit API built into gcl. 7 """ 8 9 10 def CheckChange(input_api, output_api): 11 """Checks the TSan suppressions files for bad suppressions.""" 12 13 # TODO(timurrrr): find out how to do relative imports 14 # and remove this ugly hack. Also, the CheckChange function won't be needed. 15 tools_vg_path = input_api.os_path.join(input_api.PresubmitLocalPath(), '..') 16 import sys 17 old_path = sys.path 18 try: 19 sys.path = sys.path + [tools_vg_path] 20 import suppressions 21 return suppressions.PresubmitCheck(input_api, output_api) 22 finally: 23 sys.path = old_path 24 25 26 def CheckChangeOnUpload(input_api, output_api): 27 return CheckChange(input_api, output_api) 28 29 30 def CheckChangeOnCommit(input_api, output_api): 31 return CheckChange(input_api, output_api) 32 33 34 def GetPreferredTrySlaves(): 35 return ['linux_tsan'] 36