summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 13:58:06 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 13:58:06 +0000
commit97abbf643c32727dfa38319cd98b1d407b9bf2c0 (patch)
treea86e52a2ca342da903d687223e372682c37fa59f /tools
parentea3f6a90695599c922d8bdfe3c3938048e68ded0 (diff)
downloadchromium_src-97abbf643c32727dfa38319cd98b1d407b9bf2c0.zip
chromium_src-97abbf643c32727dfa38319cd98b1d407b9bf2c0.tar.gz
chromium_src-97abbf643c32727dfa38319cd98b1d407b9bf2c0.tar.bz2
Make sure sys.path is restored after the PRESUBMIT.py execution.
R=timurrrr@chromium.org,rnk@chromium.org NOTRY=true BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10574018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/valgrind/drmemory/PRESUBMIT.py21
-rw-r--r--tools/valgrind/tsan/PRESUBMIT.py23
2 files changed, 25 insertions, 19 deletions
diff --git a/tools/valgrind/drmemory/PRESUBMIT.py b/tools/valgrind/drmemory/PRESUBMIT.py
index 126ce1b..11c7147 100644
--- a/tools/valgrind/drmemory/PRESUBMIT.py
+++ b/tools/valgrind/drmemory/PRESUBMIT.py
@@ -1,32 +1,35 @@
-# 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.
-
"""
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into gcl.
"""
-import os
-import re
-import sys
def CheckChange(input_api, output_api):
"""Checks the DrMemory suppression files for bad suppressions."""
# TODO(timurrrr): find out how to do relative imports
# and remove this ugly hack. Also, the CheckChange function won't be needed.
- tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..')
- sys.path.append(tools_vg_path)
- import suppressions
+ tools_vg_path = input_api.os_path.join(input_api.PresubmitLocalPath(), '..')
+ import sys
+ old_path = sys.path
+ try:
+ sys.path = sys.path + [tools_vg_path]
+ import suppressions
+ return suppressions.PresubmitCheck(input_api, output_api)
+ finally:
+ sys.path = old_path
- return suppressions.PresubmitCheck(input_api, output_api)
def CheckChangeOnUpload(input_api, output_api):
return CheckChange(input_api, output_api)
+
def CheckChangeOnCommit(input_api, output_api):
return CheckChange(input_api, output_api)
+
def GetPreferredTrySlaves():
return ['win_drmemory']
diff --git a/tools/valgrind/tsan/PRESUBMIT.py b/tools/valgrind/tsan/PRESUBMIT.py
index 81a5679..999dc1d 100644
--- a/tools/valgrind/tsan/PRESUBMIT.py
+++ b/tools/valgrind/tsan/PRESUBMIT.py
@@ -1,32 +1,35 @@
-# 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.
-
-import os
-import re
-import sys
-
"""
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into gcl.
"""
+
def CheckChange(input_api, output_api):
"""Checks the TSan suppressions files for bad suppressions."""
# TODO(timurrrr): find out how to do relative imports
# and remove this ugly hack. Also, the CheckChange function won't be needed.
- tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..')
- sys.path.append(tools_vg_path)
- import suppressions
+ tools_vg_path = input_api.os_path.join(input_api.PresubmitLocalPath(), '..')
+ import sys
+ old_path = sys.path
+ try:
+ sys.path = sys.path + [tools_vg_path]
+ import suppressions
+ return suppressions.PresubmitCheck(input_api, output_api)
+ finally:
+ sys.path = old_path
- return suppressions.PresubmitCheck(input_api, output_api)
def CheckChangeOnUpload(input_api, output_api):
return CheckChange(input_api, output_api)
+
def CheckChangeOnCommit(input_api, output_api):
return CheckChange(input_api, output_api)
+
def GetPreferredTrySlaves():
return ['linux_tsan']