| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 # crbug.com/145860 | 86 # crbug.com/145860 |
| 87 rm -rf ~/.android | 87 rm -rf ~/.android |
| 88 rm -rf "$build_path" | 88 rm -rf "$build_path" |
| 89 if [[ -e $build_path ]] ; then | 89 if [[ -e $build_path ]] ; then |
| 90 echo "Clobber appeared to fail? $build_path still exists." | 90 echo "Clobber appeared to fail? $build_path still exists." |
| 91 echo "@@@STEP_WARNINGS@@@" | 91 echo "@@@STEP_WARNINGS@@@" |
| 92 fi | 92 fi |
| 93 fi | 93 fi |
| 94 } | 94 } |
| 95 | 95 |
| 96 # Used internally to buildbot_functions.sh. |
| 97 function _bb_android_run_tests () { |
| 98 local FLAGS |
| 99 FLAGS="--xvfb --verbose" |
| 100 if [[ ${BUILDTYPE} = Release ]]; then |
| 101 FLAGS="${FLAGS} --release" |
| 102 fi |
| 103 build/android/run_tests.py ${FLAGS} "$@" |
| 104 } |
| 105 |
| 96 function bb_compile_setup { | 106 function bb_compile_setup { |
| 97 bb_setup_goma_internal | 107 bb_setup_goma_internal |
| 98 # Should be called only after envsetup is done. | 108 # Should be called only after envsetup is done. |
| 99 gclient runhooks | 109 gclient runhooks |
| 100 } | 110 } |
| 101 | 111 |
| 102 # Setup goma. Used internally to buildbot_functions.sh. | 112 # Setup goma. Used internally to buildbot_functions.sh. |
| 103 function bb_setup_goma_internal { | 113 function bb_setup_goma_internal { |
| 104 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key | 114 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key |
| 105 export GOMA_COMPILER_PROXY_DAEMON_MODE=true | 115 export GOMA_COMPILER_PROXY_DAEMON_MODE=true |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if [ $? -ne 0 ] ; then | 206 if [ $? -ne 0 ] ; then |
| 197 echo "@@@STEP_WARNINGS@@@" | 207 echo "@@@STEP_WARNINGS@@@" |
| 198 fi | 208 fi |
| 199 set -e | 209 set -e |
| 200 done | 210 done |
| 201 } | 211 } |
| 202 | 212 |
| 203 # Run tests on an emulator. | 213 # Run tests on an emulator. |
| 204 function bb_run_tests_emulator { | 214 function bb_run_tests_emulator { |
| 205 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" | 215 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" |
| 206 build/android/run_tests.py -e --xvfb --verbose | 216 _bb_android_run_tests -e |
| 207 } | 217 } |
| 208 | 218 |
| 209 function bb_spawn_logcat_monitor_and_status { | 219 function bb_spawn_logcat_monitor_and_status { |
| 210 python build/android/device_status_check.py | 220 python build/android/device_status_check.py |
| 211 LOGCAT_DUMP_DIR="$CHROME_SRC/out/logcat" | 221 LOGCAT_DUMP_DIR="$CHROME_SRC/out/logcat" |
| 212 rm -rf "$LOGCAT_DUMP_DIR" | 222 rm -rf "$LOGCAT_DUMP_DIR" |
| 213 python build/android/adb_logcat_monitor.py "$LOGCAT_DUMP_DIR" & | 223 python build/android/adb_logcat_monitor.py "$LOGCAT_DUMP_DIR" & |
| 214 } | 224 } |
| 215 | 225 |
| 216 function bb_print_logcat { | 226 function bb_print_logcat { |
| 217 echo "@@@BUILD_STEP Logcat dump@@@" | 227 echo "@@@BUILD_STEP Logcat dump@@@" |
| 218 python build/android/adb_logcat_printer.py "$LOGCAT_DUMP_DIR" | 228 python build/android/adb_logcat_printer.py "$LOGCAT_DUMP_DIR" |
| 219 } | 229 } |
| 220 | 230 |
| 221 # Run tests on an actual device. (Better have one plugged in!) | 231 # Run tests on an actual device. (Better have one plugged in!) |
| 222 function bb_run_unit_tests { | 232 function bb_run_unit_tests { |
| 223 echo "@@@BUILD_STEP Run unit tests on device@@@" | 233 echo "@@@BUILD_STEP Run unit tests@@@" |
| 224 build/android/run_tests.py --xvfb --verbose | 234 _bb_android_run_tests |
| 225 } | 235 } |
| 226 | 236 |
| 227 # Run WebKit's test suites: webkit_unit_tests and TestWebKitAPI | 237 # Run WebKit's test suites: webkit_unit_tests and TestWebKitAPI |
| 228 function bb_run_webkit_unit_tests { | 238 function bb_run_webkit_unit_tests { |
| 229 if [[ $BUILDTYPE = Release ]]; then | 239 echo "@@@BUILD_STEP Run webkit unit tests@@@" |
| 230 local BUILDFLAG="--release" | 240 _bb_android_run_tests -s webkit_unit_tests |
| 231 fi | 241 _bb_android_run_tests -s TestWebKitAPI |
| 232 bb_run_step build/android/run_tests.py --xvfb --verbose $BUILDFLAG \ | |
| 233 -s webkit_unit_tests | |
| 234 bb_run_step build/android/run_tests.py --xvfb --verbose $BUILDFLAG \ | |
| 235 -s TestWebKitAPI | |
| 236 } | 242 } |
| 237 | 243 |
| 238 # Lint WebKit's TestExpectation files. | 244 # Lint WebKit's TestExpectation files. |
| 239 function bb_lint_webkit_expectation_files { | 245 function bb_lint_webkit_expectation_files { |
| 240 echo "@@@BUILD_STEP webkit_lint@@@" | 246 echo "@@@BUILD_STEP webkit_lint@@@" |
| 241 bb_run_step python webkit/tools/layout_tests/run_webkit_tests.py \ | 247 bb_run_step python webkit/tools/layout_tests/run_webkit_tests.py \ |
| 242 --lint-test-files \ | 248 --lint-test-files \ |
| 243 --chromium | 249 --chromium |
| 244 } | 250 } |
| 245 | 251 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 265 --builder-name "$BUILDERNAME" \ | 271 --builder-name "$BUILDERNAME" \ |
| 266 --build-number "$BUILDNUMBER" \ | 272 --build-number "$BUILDNUMBER" \ |
| 267 --master-name "$MASTERNAME" \ | 273 --master-name "$MASTERNAME" \ |
| 268 --build-name "$BUILDERNAME" \ | 274 --build-name "$BUILDERNAME" \ |
| 269 --platform=chromium-android \ | 275 --platform=chromium-android \ |
| 270 --test-results-server "$RESULTSERVER" | 276 --test-results-server "$RESULTSERVER" |
| 271 } | 277 } |
| 272 | 278 |
| 273 # Run experimental unittest bundles. | 279 # Run experimental unittest bundles. |
| 274 function bb_run_experimental_unit_tests { | 280 function bb_run_experimental_unit_tests { |
| 275 build/android/run_tests.py --xvfb --verbose -s android_webview_unittests | 281 echo "@@@BUILD_STEP run experimental unit tests@@@" |
| 282 _bb_android_run_tests -s android_webview_unittests |
| 276 } | 283 } |
| 277 | 284 |
| 278 # Run findbugs. | 285 # Run findbugs. |
| 279 function bb_run_findbugs { | 286 function bb_run_findbugs { |
| 280 echo "@@@BUILD_STEP findbugs@@@" | 287 echo "@@@BUILD_STEP findbugs@@@" |
| 281 if [[ $BUILDTYPE = Release ]]; then | 288 if [[ $BUILDTYPE = Release ]]; then |
| 282 local BUILDFLAG="--release-build" | 289 local BUILDFLAG="--release-build" |
| 283 fi | 290 fi |
| 284 bb_run_step build/android/findbugs_diff.py $BUILDFLAG | 291 bb_run_step build/android/findbugs_diff.py $BUILDFLAG |
| 285 bb_run_step tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py \ | 292 bb_run_step tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py \ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 # Args: | 324 # Args: |
| 318 # $1: APK to be installed. | 325 # $1: APK to be installed. |
| 319 # $2: APK_PACKAGE for the APK to be installed. | 326 # $2: APK_PACKAGE for the APK to be installed. |
| 320 # $3: TEST_APK to run the tests against. | 327 # $3: TEST_APK to run the tests against. |
| 321 # $4: TEST_DATA in format destination:source | 328 # $4: TEST_DATA in format destination:source |
| 322 function bb_run_all_instrumentation_tests_for_apk { | 329 function bb_run_all_instrumentation_tests_for_apk { |
| 323 local APK=${1} | 330 local APK=${1} |
| 324 local APK_PACKAGE=${2} | 331 local APK_PACKAGE=${2} |
| 325 local TEST_APK=${3} | 332 local TEST_APK=${3} |
| 326 local TEST_DATA=${4} | 333 local TEST_DATA=${4} |
| 334 local FLAGS |
| 327 | 335 |
| 328 # Install application APK. | 336 # Install application APK. |
| 329 bb_install_apk ${APK} ${APK_PACKAGE} | 337 bb_install_apk ${APK} ${APK_PACKAGE} |
| 330 | 338 |
| 331 # Run instrumentation tests. Using -I to install the test apk. | 339 # Run instrumentation tests. Using -I to install the test apk. |
| 332 echo "@@@BUILD_STEP Run instrumentation tests ${TEST_APK}@@@" | 340 echo "@@@BUILD_STEP Run instrumentation tests ${TEST_APK}@@@" |
| 341 FLAGS="-vvv" |
| 342 if [[ "${BUILDTYPE}" == Release ]]; then |
| 343 FLAGS="${FLAGS} --release" |
| 344 fi |
| 333 bb_run_step python build/android/run_instrumentation_tests.py \ | 345 bb_run_step python build/android/run_instrumentation_tests.py \ |
| 334 -vvv --test-apk ${TEST_APK} -I --test_data ${TEST_DATA} | 346 ${FLAGS} --test-apk ${TEST_APK} -I --test_data ${TEST_DATA} |
| 335 } | 347 } |
| 336 | 348 |
| 337 # Run instrumentation tests for all relevant APKs on device. | 349 # Run instrumentation tests for all relevant APKs on device. |
| 338 function bb_run_instrumentation_tests { | 350 function bb_run_instrumentation_tests { |
| 339 bb_run_all_instrumentation_tests_for_apk "ContentShell.apk" \ | 351 bb_run_all_instrumentation_tests_for_apk "ContentShell.apk" \ |
| 340 "org.chromium.content_shell" "ContentShellTest" \ | 352 "org.chromium.content_shell" "ContentShellTest" \ |
| 341 "content:content/test/data/android/device_files" | 353 "content:content/test/data/android/device_files" |
| 342 bb_run_all_instrumentation_tests_for_apk "ChromiumTestShell.apk" \ | 354 bb_run_all_instrumentation_tests_for_apk "ChromiumTestShell.apk" \ |
| 343 "org.chromium.chrome.testshell" "ChromiumTestShellTest" \ | 355 "org.chromium.chrome.testshell" "ChromiumTestShellTest" \ |
| 344 "chrome:chrome/test/data/android/device_files" | 356 "chrome:chrome/test/data/android/device_files" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 ) | 431 ) |
| 420 } | 432 } |
| 421 | 433 |
| 422 # Retrieve a packed json property using python | 434 # Retrieve a packed json property using python |
| 423 function bb_get_json_prop { | 435 function bb_get_json_prop { |
| 424 local JSON="$1" | 436 local JSON="$1" |
| 425 local PROP="$2" | 437 local PROP="$2" |
| 426 | 438 |
| 427 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 439 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
| 428 } | 440 } |
| OLD | NEW |