blob: 352460f977711745c9615931c9687bca27dcf6d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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" mojo || 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
|