summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-04 18:16:29 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-04 18:16:29 +0000
commit23e796acf0e448c0959c1b1699e20996cf43a725 (patch)
treea2b8e8847f0b20041f93531be2c4418befd5701b /mojo
parentd52452d35a204d28876b237d1193b1def80c4e6b (diff)
downloadchromium_src-23e796acf0e448c0959c1b1699e20996cf43a725.zip
chromium_src-23e796acf0e448c0959c1b1699e20996cf43a725.tar.gz
chromium_src-23e796acf0e448c0959c1b1699e20996cf43a725.tar.bz2
Mojo: Add a script to help with building/testing parts of Mojo.
R=darin@chromium.org, darin NOTRY=True Review URL: https://codereview.chromium.org/45113002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rwxr-xr-xmojo/tools/mojob.sh116
1 files changed, 116 insertions, 0 deletions
diff --git a/mojo/tools/mojob.sh b/mojo/tools/mojob.sh
new file mode 100755
index 0000000..dd7a6b3
--- /dev/null
+++ b/mojo/tools/mojob.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+# Copyright 2013 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.
+
+# This a simple script to make building/testing Mojo components easier (on
+# Linux).
+
+# TODO(vtl): Maybe make the test runner smart and not run unchanged test
+# binaries.
+# TODO(vtl) Maybe also provide a way to pass command-line arguments to the test
+# binaries.
+
+# We're in src/mojo/tools. We want to get to src.
+cd "$(realpath "$(dirname "$0")")/../.."
+
+build() {
+ ninja -C "out/$1" || exit 1
+}
+
+unittests() {
+ "out/$1/mojo_system_unittests" || exit 1
+ "out/$1/mojo_public_unittests" || exit 1
+ "out/$1/mojo_bindings_test" || exit 1
+}
+
+perftests() {
+ "out/$1/mojo_public_perftests" || exit 1
+}
+
+for arg in "$@"; do
+ case "$arg" in
+ help|--help)
+ cat << EOF
+Usage: $(basename "$0") [command ...]
+
+command should be one of:
+ build - Build Release and Debug.
+ build-release - Build Release.
+ build-debug - Build Debug.
+ test - Run Release and Debug unit tests (does not build).
+ test-release - Run Release unit tests (does not build).
+ test-debug - Run Debug unit tests (does not build).
+ perftest - Run Release and Debug perf tests (does not build).
+ perftest-release - Run Release perf tests (does not build).
+ perftest-debug - Run Debug perf tests (does not build).
+ gyp - Run gyp for mojo (does not sync), with clang.
+ gyp-gcc - Run gyp for mojo (does not sync), without clang.
+ gyp-clang - Run gyp for mojo (does not sync), with clang.
+ sync - Sync using gclient (does not run gyp).
+ show-bash-alias - Outputs an appropriate bash alias for mojob. In bash do:
+ \$ eval \`mojo/tools/mojob.sh show-bash-alias\`
+
+Note: It will abort on the first failure (if any).
+EOF
+ exit 0
+ ;;
+ build)
+ build Release
+ build Debug
+ ;;
+ build-release)
+ build Release
+ ;;
+ build-debug)
+ build Debug
+ ;;
+ test)
+ unittests Release
+ unittests Debug
+ ;;
+ test-release)
+ unittests Release
+ ;;
+ test-debug)
+ unittests Debug
+ ;;
+ perftest)
+ perftests Release
+ perftests Debug
+ ;;
+ perftest-release)
+ perftests Release
+ ;;
+ perftest-debug)
+ perftests Debug
+ ;;
+ gyp)
+ # Default to clang.
+ GYP_DEFINES=clang=1 build/gyp_chromium mojo/mojo.gyp
+ ;;
+ gyp-gcc)
+ GYP_DEFINES=clang=0 build/gyp_chromium mojo/mojo.gyp
+ ;;
+ gyp-clang)
+ GYP_DEFINES=clang=1 build/gyp_chromium mojo/mojo.gyp
+ ;;
+ sync)
+ # Note: sync only, no gyp-ing.
+ gclient sync --nohooks
+ ;;
+ show-bash-alias)
+ # You want to type something like:
+ # alias mojob=\
+ # '"$(pwd | sed '"'"'s/\(.*\/src\).*/\1/'"'"')/mojo/tools/mojob.sh"'
+ # This is quoting hell, so we simply escape every non-alphanumeric
+ # character.
+ echo alias\ mojob\=\'\"\$\(pwd\ \|\ sed\ \'\"\'\"\'s\/\\\(\.\*\\\/src\\\)\
+\.\*\/\\1\/\'\"\'\"\'\)\/mojo\/tools\/mojob\.sh\"\'
+ ;;
+ *)
+ echo "Unknown command \"${arg}\". Try \"$(basename "$0") help\"."
+ exit 1
+ ;;
+ esac
+done