OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This a simple script to make building/testing Mojo components easier (on | 6 # This a simple script to make building/testing Mojo components easier (on |
7 # Linux). | 7 # Linux). |
8 | 8 |
9 # TODO(vtl): Maybe make the test runner smart and not run unchanged test | 9 # TODO(vtl): Maybe make the test runner smart and not run unchanged test |
10 # binaries. | 10 # binaries. |
11 # TODO(vtl) Maybe also provide a way to pass command-line arguments to the test | 11 # TODO(vtl) Maybe also provide a way to pass command-line arguments to the test |
12 # binaries. | 12 # binaries. |
13 | 13 |
14 do_help() { | 14 do_help() { |
15 cat << EOF | 15 cat << EOF |
16 Usage: $(basename "$0") [command|option ...] | 16 Usage: $(basename "$0") [command|option ...] |
17 | 17 |
18 command should be one of: | 18 command should be one of: |
19 build - Build. | 19 build - Build. |
20 test - Run unit tests (does not build). | 20 test - Run unit tests (does not build). |
21 perftest - Run Release and Debug perf tests (does not build). | 21 perftest - Run perf tests (does not build). |
| 22 pytest - Run Python unit tests. |
22 gyp - Run gyp for mojo (does not sync), with clang. | 23 gyp - Run gyp for mojo (does not sync), with clang. |
23 sync - Sync using gclient (does not run gyp). | 24 sync - Sync using gclient (does not run gyp). |
24 show-bash-alias - Outputs an appropriate bash alias for mojob. In bash do: | 25 show-bash-alias - Outputs an appropriate bash alias for mojob. In bash do: |
25 \$ eval \`mojo/tools/mojob.sh show-bash-alias\` | 26 \$ eval \`mojo/tools/mojob.sh show-bash-alias\` |
26 | 27 |
27 option (which will only apply to following commands) should be one of: | 28 option (which will only apply to following commands) should be one of: |
28 Build/test options (specified before build/test/perftest): | 29 Build/test options (specified before build/test/perftest): |
29 --debug - Build/test in Debug mode. | 30 --debug - Build/test in Debug mode. |
30 --release - Build/test in Release mode. | 31 --release - Build/test in Release mode. |
31 --debug-and-release - Build/test in both Debug and Release modes (default). | 32 --debug-and-release - Build/test in both Debug and Release modes (default). |
(...skipping 20 matching lines...) Expand all Loading... |
52 echo "Running unit tests in out/$1 ..." | 53 echo "Running unit tests in out/$1 ..." |
53 mojo/tools/test_runner.py mojo/tools/data/unittests "out/$1" \ | 54 mojo/tools/test_runner.py mojo/tools/data/unittests "out/$1" \ |
54 mojob_test_successes || exit 1 | 55 mojob_test_successes || exit 1 |
55 } | 56 } |
56 | 57 |
57 do_perftests() { | 58 do_perftests() { |
58 echo "Running perf tests in out/$1 ..." | 59 echo "Running perf tests in out/$1 ..." |
59 "out/$1/mojo_public_system_perftests" || exit 1 | 60 "out/$1/mojo_public_system_perftests" || exit 1 |
60 } | 61 } |
61 | 62 |
| 63 do_pytests() { |
| 64 echo "Running Python unit tests under mojo/public/tools/bindings/pylib ..." |
| 65 python -m unittest \ |
| 66 discover -s mojo/public/tools/bindings/pylib -p "*_unittest.py" |
| 67 } |
| 68 |
62 do_gyp() { | 69 do_gyp() { |
63 local gyp_defines="$(make_gyp_defines)" | 70 local gyp_defines="$(make_gyp_defines)" |
64 echo "Running gyp with GYP_DEFINES=$gyp_defines ..." | 71 echo "Running gyp with GYP_DEFINES=$gyp_defines ..." |
65 GYP_DEFINES="$gyp_defines" build/gyp_chromium mojo/mojo.gyp || exit 1 | 72 GYP_DEFINES="$gyp_defines" build/gyp_chromium mojo/mojo.gyp || exit 1 |
66 } | 73 } |
67 | 74 |
68 do_sync() { | 75 do_sync() { |
69 # Note: sync only (with hooks, but no gyp-ing). | 76 # Note: sync only (with hooks, but no gyp-ing). |
70 GYP_CHROMIUM_NO_ACTION=1 gclient sync || exit 1 | 77 GYP_CHROMIUM_NO_ACTION=1 gclient sync || exit 1 |
71 } | 78 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 should_do_Release && do_build Release | 144 should_do_Release && do_build Release |
138 ;; | 145 ;; |
139 test) | 146 test) |
140 should_do_Debug && do_unittests Debug | 147 should_do_Debug && do_unittests Debug |
141 should_do_Release && do_unittests Release | 148 should_do_Release && do_unittests Release |
142 ;; | 149 ;; |
143 perftest) | 150 perftest) |
144 should_do_Debug && do_perftests Debug | 151 should_do_Debug && do_perftests Debug |
145 should_do_Release && do_perftests Release | 152 should_do_Release && do_perftests Release |
146 ;; | 153 ;; |
| 154 pytest) |
| 155 do_pytests |
| 156 ;; |
147 gyp) | 157 gyp) |
148 do_gyp | 158 do_gyp |
149 ;; | 159 ;; |
150 sync) | 160 sync) |
151 do_sync | 161 do_sync |
152 ;; | 162 ;; |
153 show-bash-alias) | 163 show-bash-alias) |
154 # You want to type something like: | 164 # You want to type something like: |
155 # alias mojob=\ | 165 # alias mojob=\ |
156 # '"$(pwd | sed '"'"'s/\(.*\/src\).*/\1/'"'"')/mojo/tools/mojob.sh"' | 166 # '"$(pwd | sed '"'"'s/\(.*\/src\).*/\1/'"'"')/mojo/tools/mojob.sh"' |
(...skipping 29 matching lines...) Expand all Loading... |
186 ;; | 196 ;; |
187 --no-use-mojo) | 197 --no-use-mojo) |
188 USE_MOJO=disabled | 198 USE_MOJO=disabled |
189 ;; | 199 ;; |
190 *) | 200 *) |
191 echo "Unknown command \"${arg}\". Try \"$(basename "$0") help\"." | 201 echo "Unknown command \"${arg}\". Try \"$(basename "$0") help\"." |
192 exit 1 | 202 exit 1 |
193 ;; | 203 ;; |
194 esac | 204 esac |
195 done | 205 done |
OLD | NEW |