kjellander@webrtc.org | 5aedb29 | 2013-09-02 11:50:46 +0000 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | # Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | # |
| 4 | # Use of this source code is governed by a BSD-style license |
| 5 | # that can be found in the LICENSE file in the root of the source |
| 6 | # tree. An additional intellectual property rights grant can be found |
| 7 | # in the file PATENTS. All contributing project authors may |
| 8 | # be found in the AUTHORS file in the root of the source tree. |
| 9 | |
| 10 | """ |
| 11 | Copied from Chrome's src/tools/valgrind/drmemory/PRESUBMIT.py |
| 12 | |
| 13 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 14 | for more details on the presubmit API built into gcl. |
| 15 | """ |
| 16 | |
| 17 | import os |
| 18 | |
| 19 | |
| 20 | def CheckChange(input_api, output_api): |
| 21 | """Checks the DrMemory suppression files for bad suppressions.""" |
| 22 | |
| 23 | # Add the path to the Chrome valgrind dir to the import path: |
| 24 | tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..', '..', |
| 25 | 'valgrind') |
| 26 | import sys |
| 27 | old_path = sys.path |
| 28 | try: |
| 29 | sys.path = sys.path + [tools_vg_path] |
| 30 | import suppressions |
| 31 | return suppressions.PresubmitCheck(input_api, output_api) |
| 32 | finally: |
| 33 | sys.path = old_path |
| 34 | |
| 35 | |
| 36 | def CheckChangeOnUpload(input_api, output_api): |
| 37 | return CheckChange(input_api, output_api) |
| 38 | |
| 39 | |
| 40 | def CheckChangeOnCommit(input_api, output_api): |
| 41 | return CheckChange(input_api, output_api) |
| 42 | |
| 43 | |
| 44 | def GetPreferredTrySlaves(): |
| 45 | # We don't have any Dr Memory trybots yet, so there's no use for this method. |
| 46 | # When we have, the slave name(s) should be put into this list. |
| 47 | return [] |