| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 function bb_print_logcat { | 200 function bb_print_logcat { |
| 201 echo "@@@BUILD_STEP Logcat dump@@@" | 201 echo "@@@BUILD_STEP Logcat dump@@@" |
| 202 python build/android/adb_logcat_printer.py "$LOGCAT_DUMP_DIR" | 202 python build/android/adb_logcat_printer.py "$LOGCAT_DUMP_DIR" |
| 203 } | 203 } |
| 204 | 204 |
| 205 # Run tests on an actual device. (Better have one plugged in!) | 205 # Run tests on an actual device. (Better have one plugged in!) |
| 206 function bb_run_unit_tests { | 206 function bb_run_unit_tests { |
| 207 build/android/run_tests.py --xvfb --verbose | 207 build/android/run_tests.py --xvfb --verbose |
| 208 } | 208 } |
| 209 | 209 |
| 210 # Run instrumentation test. | 210 # Run a buildbot step and handle failure. |
| 211 # Args: | 211 function bb_run_step { |
| 212 # $1: TEST_APK. | 212 ( |
| 213 # $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py. | 213 set +e |
| 214 function bb_run_instrumentation_test { | 214 "$@" |
| 215 local TEST_APK=${1} | 215 if [[ $? != 0 ]]; then |
| 216 local EXTRA_FLAGS=${2} | 216 echo "@@@STEP_FAILURE@@@" |
| 217 local INSTRUMENTATION_FLAGS="-vvv" | 217 fi |
| 218 INSTRUMENTATION_FLAGS+=" --test-apk ${TEST_APK}" | 218 ) |
| 219 INSTRUMENTATION_FLAGS+=" ${EXTRA_FLAGS}" | |
| 220 build/android/run_instrumentation_tests.py ${INSTRUMENTATION_FLAGS} | |
| 221 } | 219 } |
| 222 | 220 |
| 223 # Run content shell instrumentation test on device. | 221 # Run instrumentation tests for a specific APK. |
| 222 # Args: |
| 223 # $1: APK to be installed. |
| 224 # $2: APK_PACKAGE for the APK to be installed. |
| 225 # $3: TEST_APK to run the tests against. |
| 226 function bb_run_all_instrumentation_tests_for_apk { |
| 227 local APK=${1} |
| 228 local APK_PACKAGE=${2} |
| 229 local TEST_APK=${3} |
| 230 |
| 231 # Install application APK. |
| 232 python build/android/adb_install_apk.py --apk ${APK} \ |
| 233 --apk_package ${APK_PACKAGE} |
| 234 |
| 235 # Run instrumentation tests. Using -I to install the test apk. |
| 236 bb_run_step python build/android/run_instrumentation_tests.py \ |
| 237 -vvv --test-apk ${TEST_APK} -I |
| 238 } |
| 239 |
| 240 # Run instrumentation tests for all relevant APKs on device. |
| 224 function bb_run_instrumentation_tests { | 241 function bb_run_instrumentation_tests { |
| 225 build/android/adb_install_content_shell | 242 bb_run_all_instrumentation_tests_for_apk "ContentShell-debug.apk" \ |
| 226 local TEST_APK="ContentShellTest" | 243 "org.chromium.content_shell" "ContentShellTest" |
| 227 # Use -I to install the test apk only on the first run. | 244 bb_run_all_instrumentation_tests_for_apk "ChromiumTestShell-debug.apk" \ |
| 228 # TODO(bulach): remove the second once we have a Smoke test. | 245 "org.chromium.chrome.browser" "ChromiumTestShellTest" |
| 229 bb_run_instrumentation_test ${TEST_APK} "-I -A Smoke" | 246 bb_run_all_instrumentation_tests_for_apk "AndroidWebView-debug.apk" \ |
| 230 bb_run_instrumentation_test ${TEST_APK} "-I -A SmallTest" | 247 "org.chromium.android_webview" "AndroidWebViewTest" |
| 231 bb_run_instrumentation_test ${TEST_APK} "-A MediumTest" | |
| 232 bb_run_instrumentation_test ${TEST_APK} "-A LargeTest" | |
| 233 } | 248 } |
| 234 | 249 |
| 235 # Zip and archive a build. | 250 # Zip and archive a build. |
| 236 function bb_zip_build { | 251 function bb_zip_build { |
| 237 echo "@@@BUILD_STEP Zip build@@@" | 252 echo "@@@BUILD_STEP Zip build@@@" |
| 238 python ../../../../scripts/slave/zip_build.py \ | 253 python ../../../../scripts/slave/zip_build.py \ |
| 239 --src-dir "$SRC_ROOT" \ | 254 --src-dir "$SRC_ROOT" \ |
| 240 --exclude-files "lib.target,gen,android_webview,jingle_unittests" \ | 255 --exclude-files "lib.target,gen,android_webview,jingle_unittests" \ |
| 241 --factory-properties "$FACTORY_PROPERTIES" \ | 256 --factory-properties "$FACTORY_PROPERTIES" \ |
| 242 --build-properties "$BUILD_PROPERTIES" | 257 --build-properties "$BUILD_PROPERTIES" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 ) | 314 ) |
| 300 } | 315 } |
| 301 | 316 |
| 302 # Retrieve a packed json property using python | 317 # Retrieve a packed json property using python |
| 303 function bb_get_json_prop { | 318 function bb_get_json_prop { |
| 304 local JSON="$1" | 319 local JSON="$1" |
| 305 local PROP="$2" | 320 local PROP="$2" |
| 306 | 321 |
| 307 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 322 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
| 308 } | 323 } |
| OLD | NEW |