summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorearthdok <earthdok@chromium.org>2015-03-25 06:25:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-25 13:26:21 +0000
commitb251b58b4c97a520b29269c84895a5423736346c (patch)
tree0336d6c3a6ab65313ee520430bea1cfb7f0e2b80
parent346f30ca47612c605de5ae38ac892a6b55554198 (diff)
downloadchromium_src-b251b58b4c97a520b29269c84895a5423736346c.zip
chromium_src-b251b58b4c97a520b29269c84895a5423736346c.tar.gz
chromium_src-b251b58b4c97a520b29269c84895a5423736346c.tar.bz2
Instrumented libraries: add a script to build/package binaries.
BUG=462636 R=glider@chromium.org NOTRY=true Review URL: https://codereview.chromium.org/1019213003 Cr-Commit-Position: refs/heads/master@{#322149}
-rwxr-xr-xthird_party/instrumented_libraries/scripts/build_and_package.sh83
1 files changed, 83 insertions, 0 deletions
diff --git a/third_party/instrumented_libraries/scripts/build_and_package.sh b/third_party/instrumented_libraries/scripts/build_and_package.sh
new file mode 100755
index 0000000..30b20da
--- /dev/null
+++ b/third_party/instrumented_libraries/scripts/build_and_package.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+# Copyright 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.
+
+set -eu
+
+supported_build_types="msan-no-origins msan-chained-origins"
+supported_releases="precise trusty"
+ubuntu_release=$(lsb_release -cs)
+
+function show_help {
+ echo "Usage: build_and_package.sh <build_type>"
+ echo "Supported build types: all ${supported_build_types}"
+}
+
+function build_libraries {
+ local build_type=$1
+ case ${build_type} in
+ "msan-chained-origins")
+ local gyp_defines="msan=1 msan_track_origins=2"
+ ;;
+ "msan-no-origins")
+ local gyp_defines="msan=1 msan_track_origins=0"
+ ;;
+ *)
+ show_help
+ exit 1
+ ;;
+ esac
+
+ local archive_name=${build_type}-${ubuntu_release}
+ local out_dir=out_${archive_name}
+
+ echo "Building instrumented libraries in ${out_dir}..."
+
+ rm -rf $out_dir
+ mkdir $out_dir
+
+ GYP_DEFINES="${gyp_defines} use_instrumented_libraries=1 instrumented_libraries_jobs=8" \
+ GYP_GENERATOR_FLAGS="output_dir=${out_dir}" \
+ gclient runhooks
+
+ ninja -C ${out_dir}/Release instrumented_libraries
+
+ echo "Creating archive ${archive_name}.tgz..."
+
+ files=$(ls -1 ${out_dir}/Release/instrumented_libraries)
+
+ tar zcf ${archive_name}.tgz -C ${out_dir}/Release/instrumented_libraries --exclude="?san/*.txt" ${files}
+
+ echo To upload, run:
+ echo upload_to_google_storage.py -b chromium-instrumented-libraries ${archive_name}.tgz
+ echo You should then commit the resulting .sha1 file.
+}
+
+if ! [[ "${supported_releases}" =~ ${ubuntu_release} ]]
+then
+ echo "Unsupported Ubuntu release: ${ubuntu_release}"
+ exit 1
+fi
+
+if [ -z "${1-}" ]
+then
+ show_help
+ exit 0
+fi
+
+if ! [[ "all ${supported_build_types}" =~ $1 ]]
+then
+ show_help
+ exit 1
+fi
+if [ "$1" == "all" ]
+then
+ for build_type in ${supported_build_types}
+ do
+ build_libraries ${build_type}
+ done
+else
+ build_libraries $1
+fi
+