summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorearthdok <earthdok@chromium.org>2015-03-23 14:07:20 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-23 21:08:09 +0000
commitd58713223f0c4c9eaba12337d543d1b9d6de16c1 (patch)
tree1e1380499d4a252565b87eccdb35cc61f97b08dc
parent09076881792dc0f91937592ba713b1f64598766b (diff)
downloadchromium_src-d58713223f0c4c9eaba12337d543d1b9d6de16c1.zip
chromium_src-d58713223f0c4c9eaba12337d543d1b9d6de16c1.tar.gz
chromium_src-d58713223f0c4c9eaba12337d543d1b9d6de16c1.tar.bz2
Instrumented libraries: add a hook to download pre-built binaries.
BUG=462636 R=glider@chromium.org TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1019573003 Cr-Commit-Position: refs/heads/master@{#321849}
-rw-r--r--DEPS7
-rw-r--r--third_party/instrumented_libraries/binaries/.gitignore2
-rw-r--r--third_party/instrumented_libraries/binaries/msan-chained-origins-precise.tgz.sha11
-rw-r--r--third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha11
-rwxr-xr-xthird_party/instrumented_libraries/scripts/download_binaries.py59
5 files changed, 70 insertions, 0 deletions
diff --git a/DEPS b/DEPS
index d84fee8..9a8d701 100644
--- a/DEPS
+++ b/DEPS
@@ -761,6 +761,13 @@ hooks = [
],
},
{
+ # Pull sanitizer-instrumented third-party libraries if requested via
+ # GYP_DEFINES.
+ 'name': 'instrumented_libraries',
+ 'pattern': '\\.sha1',
+ 'action': ['python', 'src/third_party/instrumented_libraries/scripts/download_binaries.py'],
+ },
+ {
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
'name': 'gyp',
'pattern': '.',
diff --git a/third_party/instrumented_libraries/binaries/.gitignore b/third_party/instrumented_libraries/binaries/.gitignore
new file mode 100644
index 0000000..d177d9a
--- /dev/null
+++ b/third_party/instrumented_libraries/binaries/.gitignore
@@ -0,0 +1,2 @@
+# Ignore downloaded binaries.
+*.tgz
diff --git a/third_party/instrumented_libraries/binaries/msan-chained-origins-precise.tgz.sha1 b/third_party/instrumented_libraries/binaries/msan-chained-origins-precise.tgz.sha1
new file mode 100644
index 0000000..71e2def
--- /dev/null
+++ b/third_party/instrumented_libraries/binaries/msan-chained-origins-precise.tgz.sha1
@@ -0,0 +1 @@
+60669b8a67026d92b365c1a2cab756bfe2fdd90f \ No newline at end of file
diff --git a/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1 b/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1
new file mode 100644
index 0000000..193be34
--- /dev/null
+++ b/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz.sha1
@@ -0,0 +1 @@
+348b21c99365227beb378e6f068984b0f6ea9f9f \ No newline at end of file
diff --git a/third_party/instrumented_libraries/scripts/download_binaries.py b/third_party/instrumented_libraries/scripts/download_binaries.py
new file mode 100755
index 0000000..62ef9fc
--- /dev/null
+++ b/third_party/instrumented_libraries/scripts/download_binaries.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# Copyright (c) 2015 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.
+
+"""Downloads pre-built sanitizer-instrumented third-party libraries from GCS."""
+
+import os
+import re
+import subprocess
+import sys
+
+def get_ubuntu_release():
+ supported_releases = ['precise', 'trusty']
+ release = subprocess.check_output(['lsb_release', '-cs']).strip()
+ if release not in supported_releases:
+ raise Exception("Supported Ubuntu versions: %s", str(supported_releases))
+ return release
+
+
+def get_configuration(gyp_defines):
+ if re.search(r'\b(msan)=1', gyp_defines):
+ if 'msan_track_origins=2' in gyp_defines:
+ return 'msan-chained-origins'
+ if 'msan_track_origins=' not in gyp_defines:
+ # NB: must be the same as the default value in common.gypi
+ return 'msan-chained-origins'
+ raise Exception(
+ "Prebuilt instrumented libraries not available for your configuration.")
+
+
+def get_archive_name(gyp_defines):
+ return "%s-%s.tgz" % (get_configuration(gyp_defines), get_ubuntu_release())
+
+
+def main(args):
+ gyp_defines = os.environ.get('GYP_DEFINES', '')
+ if not 'use_prebuilt_instrumented_libraries=1' in gyp_defines:
+ return 0
+
+ if not sys.platform.startswith('linux'):
+ raise Exception("'use_prebuilt_instrumented_libraries=1' requires Linux.")
+
+ archive_name = get_archive_name(gyp_defines)
+ sha1file = '%s.sha1' % archive_name
+ target_directory = 'src/third_party/instrumented_libraries/binaries/'
+
+ subprocess.check_call([
+ 'download_from_google_storage',
+ '--no_resume',
+ '--no_auth',
+ '--bucket', 'chromium-instrumented-libraries',
+ '-s', sha1file], cwd=target_directory)
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))