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 # Setup environment for Android build. |
| 17 # Called from bb_baseline_setup. |
| 18 # Moved to top of file so it is easier to find. |
| 19 function bb_setup_environment { |
| 20 export ANDROID_SDK_ROOT=/usr/local/google/android-sdk-linux |
| 21 export ANDROID_NDK_ROOT=/usr/local/google/android-ndk-r7 |
| 22 } |
| 23 |
| 24 # Install the build deps by running |
| 25 # build/install-build-deps-android.sh. This may update local tools. |
| 26 # $1: source root. |
| 27 function bb_install_build_deps { |
| 28 echo "@@@BUILD_STEP install build deps android@@@" |
| 29 local script="$1/build/install-build-deps-android.sh" |
| 30 if [[ -f "$script" ]]; then |
| 31 "$script" |
| 32 else |
| 33 echo "Cannot find $script; why?" |
| 34 fi |
| 35 } |
| 36 |
16 # Function to force-green a bot. | 37 # Function to force-green a bot. |
17 function bb_force_bot_green_and_exit { | 38 function bb_force_bot_green_and_exit { |
18 echo "@@@BUILD_STEP Bot forced green.@@@" | 39 echo "@@@BUILD_STEP Bot forced green.@@@" |
19 exit 0 | 40 exit 0 |
20 } | 41 } |
21 | 42 |
22 # Basic setup for all bots to run after a source tree checkout. | 43 # Basic setup for all bots to run after a source tree checkout. |
23 # $1: source root. | 44 # $1: source root. |
24 function bb_baseline_setup { | 45 function bb_baseline_setup { |
25 echo "@@@BUILD_STEP cd into source root@@@" | 46 echo "@@@BUILD_STEP cd into source root@@@" |
26 SRC_ROOT="$1" | 47 SRC_ROOT="$1" |
27 if [ ! -d "${SRC_ROOT}" ] ; then | 48 if [ ! -d "${SRC_ROOT}" ] ; then |
28 echo "Please specify a valid source root directory as an arg" | 49 echo "Please specify a valid source root directory as an arg" |
29 echo '@@@STEP_FAILURE@@@' | 50 echo '@@@STEP_FAILURE@@@' |
30 return 1 | 51 return 1 |
31 fi | 52 fi |
32 cd $SRC_ROOT | 53 cd $SRC_ROOT |
33 | 54 |
34 if [ ! -f build/android/envsetup.sh ] ; then | 55 if [ ! -f build/android/envsetup.sh ] ; then |
35 echo "No envsetup.sh" | 56 echo "No envsetup.sh" |
36 echo "@@@STEP_FAILURE@@@" | 57 echo "@@@STEP_FAILURE@@@" |
37 return 1 | 58 return 1 |
38 fi | 59 fi |
39 | 60 |
40 echo "@@@BUILD_STEP Basic setup@@@" | 61 echo "@@@BUILD_STEP Basic setup@@@" |
41 export ANDROID_SDK_ROOT=/usr/local/google/android-sdk-linux | 62 bb_setup_environment |
42 export ANDROID_NDK_ROOT=/usr/local/google/android-ndk-r7 | |
43 for mandatory_directory in "${ANDROID_SDK_ROOT}" "${ANDROID_NDK_ROOT}" ; do | 63 for mandatory_directory in "${ANDROID_SDK_ROOT}" "${ANDROID_NDK_ROOT}" ; do |
44 if [[ ! -d "${mandatory_directory}" ]]; then | 64 if [[ ! -d "${mandatory_directory}" ]]; then |
45 echo "Directory ${mandatory_directory} does not exist." | 65 echo "Directory ${mandatory_directory} does not exist." |
46 echo "Build cannot continue." | 66 echo "Build cannot continue." |
47 echo "@@@STEP_FAILURE@@@" | 67 echo "@@@STEP_FAILURE@@@" |
48 return 1 | 68 return 1 |
49 fi | 69 fi |
50 done | 70 done |
51 | 71 |
52 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then | 72 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 function bb_run_tests_emulator { | 116 function bb_run_tests_emulator { |
97 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" | 117 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" |
98 build/android/run_tests.py -e --xvfb --verbose | 118 build/android/run_tests.py -e --xvfb --verbose |
99 } | 119 } |
100 | 120 |
101 # Run tests on an actual device. (Better have one plugged in!) | 121 # Run tests on an actual device. (Better have one plugged in!) |
102 function bb_run_tests { | 122 function bb_run_tests { |
103 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" | 123 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" |
104 build/android/run_tests.py --xvfb --verbose | 124 build/android/run_tests.py --xvfb --verbose |
105 } | 125 } |
OLD | NEW |