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"""
5See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
6for more details on the presubmit API built into gcl.
7"""
8
9
10def 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
26def CheckChangeOnUpload(input_api, output_api):
27  return CheckChange(input_api, output_api)
28
29
30def CheckChangeOnCommit(input_api, output_api):
31  return CheckChange(input_api, output_api)
32
33
34def GetPreferredTryMasters(project, change):
35  return {
36    'tryserver.chromium': {
37      'linux_tsan': set(['defaulttests']),
38    }
39  }
40