OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # Bash functions used by buildbot annotator scripts for the android | 6 # Bash functions used by buildbot annotator scripts for the android |
7 # build of chromium. Executing this script should not perform actions | 7 # build of chromium. Executing this script should not perform actions |
8 # other than setting variables and defining of functions. | 8 # other than setting variables and defining of functions. |
9 | 9 |
10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" | 10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" |
11 JOBS="${JOBS:-4}" | 11 JOBS="${JOBS:-4}" |
12 | 12 |
13 # Clobber build? Overridden by bots with BUILDBOT_CLOBBER. | 13 # Clobber build? Overridden by bots with BUILDBOT_CLOBBER. |
14 NEED_CLOBBER="${NEED_CLOBBER:-0}" | 14 NEED_CLOBBER="${NEED_CLOBBER:-0}" |
15 | 15 |
16 | |
17 # Parse named arguments passed into the annotator script | |
18 # and assign them global variable names | |
cmp
2012/06/19 20:46:42
nit: please append periods to the end of all sente
| |
19 function bb_parse_args { | |
20 while [[ $1 ]]; do | |
21 case "$1" in | |
22 --factory-properties=*) | |
23 FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" | |
cmp
2012/06/19 20:46:42
The content of FACTORY_PROPERTIES and BUILD_PROPER
Isaac (away)
2012/06/20 00:34:53
Right now zip_build and extract_build already pars
cmp
2012/06/20 17:30:06
Right, I didn't expect you to need to extract anyt
| |
24 ;; | |
25 --build-properties=*) | |
26 BUILD_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" | |
27 ;; | |
28 *) | |
29 echo "@@@STEP_WARNINGS@@@" | |
30 echo "Warning, unparsed input argument: '$1'" | |
31 ;; | |
32 esac | |
33 shift | |
34 done | |
35 } | |
36 | |
37 | |
16 # Setup environment for Android build. | 38 # Setup environment for Android build. |
17 # Called from bb_baseline_setup. | 39 # Called from bb_baseline_setup. |
18 # Moved to top of file so it is easier to find. | 40 # Moved to top of file so it is easier to find. |
19 function bb_setup_environment { | 41 function bb_setup_environment { |
20 export ANDROID_SDK_ROOT=/usr/local/google/android-sdk-linux | 42 export ANDROID_SDK_ROOT=/usr/local/google/android-sdk-linux |
21 export ANDROID_NDK_ROOT=/usr/local/google/android-ndk-r7 | 43 export ANDROID_NDK_ROOT=/usr/local/google/android-ndk-r7 |
22 } | 44 } |
23 | 45 |
24 # Install the build deps by running | 46 # Install the build deps by running |
25 # build/install-build-deps-android-sdk.sh. This may update local tools. | 47 # build/install-build-deps-android-sdk.sh. This may update local tools. |
26 # $1: source root. | 48 # $1: source root. |
27 function bb_install_build_deps { | 49 function bb_install_build_deps { |
28 echo "@@@BUILD_STEP install build deps android@@@" | 50 echo "@@@BUILD_STEP install build deps android@@@" |
29 local script="$1/build/install-build-deps-android-sdk.sh" | 51 local script="$1/build/install-build-deps-android-sdk.sh" |
30 if [[ -f "$script" ]]; then | 52 if [[ -f "$script" ]]; then |
31 "$script" | 53 "$script" |
32 else | 54 else |
55 echo "@@@STEP_WARNINGS@@@" | |
33 echo "Cannot find $script; why?" | 56 echo "Cannot find $script; why?" |
34 fi | 57 fi |
35 } | 58 } |
36 | 59 |
37 # Function to force-green a bot. | 60 # Function to force-green a bot. |
38 function bb_force_bot_green_and_exit { | 61 function bb_force_bot_green_and_exit { |
39 echo "@@@BUILD_STEP Bot forced green.@@@" | 62 echo "@@@BUILD_STEP Bot forced green.@@@" |
40 exit 0 | 63 exit 0 |
41 } | 64 } |
42 | 65 |
43 # Basic setup for all bots to run after a source tree checkout. | 66 # Basic setup for all bots to run after a source tree checkout. |
44 # $1: source root. | 67 # $1: source root. |
68 # Beyond $1: key value pairs to be parsed by bb_parse_args | |
45 function bb_baseline_setup { | 69 function bb_baseline_setup { |
46 echo "@@@BUILD_STEP cd into source root@@@" | 70 echo "@@@BUILD_STEP cd into source root@@@" |
47 SRC_ROOT="$1" | 71 SRC_ROOT="$1" |
72 # Remove SRC_ROOT param | |
73 shift | |
74 | |
75 bb_parse_args "$@" | |
76 | |
48 if [ ! -d "${SRC_ROOT}" ] ; then | 77 if [ ! -d "${SRC_ROOT}" ] ; then |
49 echo "Please specify a valid source root directory as an arg" | 78 echo "Please specify a valid source root directory as an arg" |
50 echo '@@@STEP_FAILURE@@@' | 79 echo '@@@STEP_FAILURE@@@' |
51 return 1 | 80 return 1 |
52 fi | 81 fi |
53 cd $SRC_ROOT | 82 cd $SRC_ROOT |
54 | 83 |
55 if [ ! -f build/android/envsetup.sh ] ; then | 84 if [ ! -f build/android/envsetup.sh ] ; then |
56 echo "No envsetup.sh" | 85 echo "No envsetup.sh" |
57 echo "@@@STEP_FAILURE@@@" | 86 echo "@@@STEP_FAILURE@@@" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 function bb_run_tests { | 259 function bb_run_tests { |
231 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" | 260 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" |
232 build/android/run_tests.py --xvfb --verbose | 261 build/android/run_tests.py --xvfb --verbose |
233 } | 262 } |
234 | 263 |
235 # Run APK tests on an actual device. | 264 # Run APK tests on an actual device. |
236 function bb_run_apk_tests { | 265 function bb_run_apk_tests { |
237 echo "@@@BUILD_STEP Run APK Tests on actual hardware@@@" | 266 echo "@@@BUILD_STEP Run APK Tests on actual hardware@@@" |
238 build/android/run_tests.py --xvfb --verbose --apk=True | 267 build/android/run_tests.py --xvfb --verbose --apk=True |
239 } | 268 } |
269 | |
270 # Zip and archive a build | |
271 function bb_zip_build { | |
272 echo "@@@BUILD_STEP Zip build@@@" | |
273 python ../../../../scripts/slave/zip_build.py | |
274 } | |
275 | |
276 # Download and extract a build | |
277 function bb_extract_build { | |
278 echo "@@@BUILD_STEP Download and extract build@@@" | |
279 if [[ -z $FACTORY_PROPERTIES ]]; then | |
280 echo "@@@STEP_FAILURES@@@" | |
281 echo "FACTORY_PROPERTIES is null" | |
282 return 1 | |
283 fi | |
284 | |
285 # FACTORY_PROPERTIES contains spaces | |
286 python ../../../../scripts/slave/extract_build.py --no-append-dir \ | |
287 --build-dir out \ | |
288 --target Release \ | |
289 --factory-properties "$FACTORY_PROPERTIES" | |
290 } | |
OLD | NEW |