| 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}" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 # $@: make args. | 152 # $@: make args. |
| 153 # Use goma if possible; degrades to non-Goma if needed. | 153 # Use goma if possible; degrades to non-Goma if needed. |
| 154 function bb_goma_make { | 154 function bb_goma_make { |
| 155 bb_setup_goma_internal | 155 bb_setup_goma_internal |
| 156 | 156 |
| 157 if [ "${GOMA_DIR}" = "" ]; then | 157 if [ "${GOMA_DIR}" = "" ]; then |
| 158 make -j${JOBS} "$@" | 158 make -j${JOBS} "$@" |
| 159 return | 159 return |
| 160 fi | 160 fi |
| 161 | 161 |
| 162 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) |
| 162 HOST_CC=$GOMA_DIR/gcc | 163 HOST_CC=$GOMA_DIR/gcc |
| 163 HOST_CXX=$GOMA_DIR/g++ | 164 HOST_CXX=$GOMA_DIR/g++ |
| 164 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) | 165 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) |
| 165 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) | 166 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) |
| 166 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" | 167 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" |
| 167 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" | 168 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" |
| 168 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ | 169 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ |
| 169 -target 1.5 -Xmaxerrs 9999999" | 170 -target 1.5 -Xmaxerrs 9999999" |
| 170 | 171 |
| 171 command make \ | 172 command make \ |
| 172 -j100 \ | 173 -j100 \ |
| 173 -l20 \ | 174 -l20 \ |
| 174 HOST_CC="$HOST_CC" \ | 175 HOST_CC="$HOST_CC" \ |
| 175 HOST_CXX="$HOST_CXX" \ | 176 HOST_CXX="$HOST_CXX" \ |
| 176 TARGET_CC="$TARGET_CC" \ | 177 TARGET_CC="$TARGET_CC" \ |
| 177 TARGET_CXX="$TARGET_CXX" \ | 178 TARGET_CXX="$TARGET_CXX" \ |
| 178 CC.host="$HOST_CC" \ | 179 CC.host="$HOST_CC" \ |
| 179 CXX.host="$HOST_CXX" \ | 180 CXX.host="$HOST_CXX" \ |
| 180 CC.target="$TARGET_CC" \ | 181 CC.target="$TARGET_CC" \ |
| 181 CXX.target="$TARGET_CXX" \ | 182 CXX.target="$TARGET_CXX" \ |
| 182 LINK.target="$TARGET_CXX" \ | 183 LINK.target="$TARGET_CXX" \ |
| 183 COMMON_JAVAC="$COMMON_JAVAC" \ | 184 COMMON_JAVAC="$COMMON_JAVAC" \ |
| 185 BUILDTYPE="$BUILDTYPE" \ |
| 184 "$@" | 186 "$@" |
| 185 | 187 |
| 186 local make_exit_code=$? | 188 local make_exit_code=$? |
| 187 bb_stop_goma_internal | 189 bb_stop_goma_internal |
| 188 return $make_exit_code | 190 return $make_exit_code |
| 189 } | 191 } |
| 190 | 192 |
| 191 # Compile step | 193 # Compile step |
| 192 function bb_compile { | 194 function bb_compile { |
| 193 # This must be named 'compile', not 'Compile', for CQ interaction. | 195 # This must be named 'compile', not 'Compile', for CQ interaction. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 211 done | 213 done |
| 212 } | 214 } |
| 213 | 215 |
| 214 # Run tests on an emulator. | 216 # Run tests on an emulator. |
| 215 function bb_run_tests_emulator { | 217 function bb_run_tests_emulator { |
| 216 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" | 218 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" |
| 217 build/android/run_tests.py -e --xvfb --verbose | 219 build/android/run_tests.py -e --xvfb --verbose |
| 218 } | 220 } |
| 219 | 221 |
| 220 # Run tests on an actual device. (Better have one plugged in!) | 222 # Run tests on an actual device. (Better have one plugged in!) |
| 221 function bb_run_tests { | 223 function bb_run_unit_tests { |
| 222 python build/android/device_status_check.py | 224 python build/android/device_status_check.py |
| 223 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" | 225 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" |
| 224 build/android/run_tests.py --xvfb --verbose | 226 build/android/run_tests.py --xvfb --verbose |
| 225 } | 227 } |
| 226 | 228 |
| 227 # Run instrumentation test. | 229 # Run instrumentation test. |
| 228 # Args: | 230 # Args: |
| 229 # $1: TEST_APK. | 231 # $1: TEST_APK. |
| 230 # $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py. | 232 # $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py. |
| 231 function bb_run_instrumentation_test { | 233 function bb_run_instrumentation_test { |
| 232 local TEST_APK=${1} | 234 local TEST_APK=${1} |
| 233 local EXTRA_FLAGS=${2} | 235 local EXTRA_FLAGS=${2} |
| 234 local APK_NAME=$(basename ${TEST_APK}) | 236 local APK_NAME=$(basename ${TEST_APK}) |
| 235 echo "@@@BUILD_STEP Android Instrumentation ${APK_NAME} ${EXTRA_FLAGS} "\ | 237 echo "@@@BUILD_STEP Android Instrumentation ${APK_NAME} ${EXTRA_FLAGS} "\ |
| 236 "on actual hardware@@@" | 238 "on actual hardware@@@" |
| 237 local INSTRUMENTATION_FLAGS="-vvv" | 239 local INSTRUMENTATION_FLAGS="-vvv" |
| 238 INSTRUMENTATION_FLAGS+=" --test-apk ${TEST_APK}" | 240 INSTRUMENTATION_FLAGS+=" --test-apk ${TEST_APK}" |
| 239 INSTRUMENTATION_FLAGS+=" ${EXTRA_FLAGS}" | 241 INSTRUMENTATION_FLAGS+=" ${EXTRA_FLAGS}" |
| 240 build/android/run_instrumentation_tests.py ${INSTRUMENTATION_FLAGS} | 242 build/android/run_instrumentation_tests.py ${INSTRUMENTATION_FLAGS} |
| 241 } | 243 } |
| 242 | 244 |
| 243 # Run content shell instrumentation test on device. | 245 # Run content shell instrumentation test on device. |
| 244 function bb_run_content_shell_instrumentation_test { | 246 function bb_run_instrumentation_tests { |
| 245 build/android/adb_install_content_shell | 247 build/android/adb_install_content_shell |
| 246 local TEST_APK="content_shell_test/ContentShellTest-debug" | 248 local TEST_APK="content_shell_test/ContentShellTest-debug" |
| 247 # Use -I to install the test apk only on the first run. | 249 # Use -I to install the test apk only on the first run. |
| 248 # TODO(bulach): remove the second once we have a Smoke test. | 250 # TODO(bulach): remove the second once we have a Smoke test. |
| 249 bb_run_instrumentation_test ${TEST_APK} "-I -A Smoke" | 251 bb_run_instrumentation_test ${TEST_APK} "-I -A Smoke" |
| 250 bb_run_instrumentation_test ${TEST_APK} "-I -A SmallTest" | 252 bb_run_instrumentation_test ${TEST_APK} "-I -A SmallTest" |
| 251 bb_run_instrumentation_test ${TEST_APK} "-A MediumTest" | 253 bb_run_instrumentation_test ${TEST_APK} "-A MediumTest" |
| 252 bb_run_instrumentation_test ${TEST_APK} "-A LargeTest" | 254 bb_run_instrumentation_test ${TEST_APK} "-A LargeTest" |
| 253 } | 255 } |
| 254 | 256 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 set +e | 314 set +e |
| 313 cd "${SRC_ROOT}" | 315 cd "${SRC_ROOT}" |
| 314 python android_webview/tools/webview_licenses.py scan | 316 python android_webview/tools/webview_licenses.py scan |
| 315 local license_exit_code=$? | 317 local license_exit_code=$? |
| 316 if [[ license_exit_code -ne 0 ]]; then | 318 if [[ license_exit_code -ne 0 ]]; then |
| 317 echo "@@@STEP_FAILURE@@@" | 319 echo "@@@STEP_FAILURE@@@" |
| 318 fi | 320 fi |
| 319 return $license_exit_code | 321 return $license_exit_code |
| 320 ) | 322 ) |
| 321 } | 323 } |
| 324 |
| 325 # Retrieve a packed json property using python |
| 326 function bb_get_json_prop { |
| 327 local JSON="$1" |
| 328 local PROP="$2" |
| 329 |
| 330 python -c "import json; print json.loads('$JSON')['$PROP']" |
| 331 } |
| OLD | NEW |