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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 function bb_run_step { | 287 function bb_run_step { |
288 ( | 288 ( |
289 set +e | 289 set +e |
290 "$@" | 290 "$@" |
291 if [[ $? != 0 ]]; then | 291 if [[ $? != 0 ]]; then |
292 echo "@@@STEP_FAILURE@@@" | 292 echo "@@@STEP_FAILURE@@@" |
293 fi | 293 fi |
294 ) | 294 ) |
295 } | 295 } |
296 | 296 |
| 297 # Install a specific APK. |
| 298 # Args: |
| 299 # $1: APK to be installed. |
| 300 # $2: APK_PACKAGE for the APK to be installed. |
| 301 function bb_install_apk { |
| 302 local APK=${1} |
| 303 local APK_PACKAGE=${2} |
| 304 if [[ $BUILDTYPE = Release ]]; then |
| 305 local BUILDFLAG="--release" |
| 306 fi |
| 307 |
| 308 echo "@@@BUILD_STEP Install ${APK}@@@" |
| 309 python build/android/adb_install_apk.py --apk ${APK} \ |
| 310 --apk_package ${APK_PACKAGE} ${BUILDFLAG} |
| 311 } |
| 312 |
297 # Run instrumentation tests for a specific APK. | 313 # Run instrumentation tests for a specific APK. |
298 # Args: | 314 # Args: |
299 # $1: APK to be installed. | 315 # $1: APK to be installed. |
300 # $2: APK_PACKAGE for the APK to be installed. | 316 # $2: APK_PACKAGE for the APK to be installed. |
301 # $3: TEST_APK to run the tests against. | 317 # $3: TEST_APK to run the tests against. |
302 function bb_run_all_instrumentation_tests_for_apk { | 318 function bb_run_all_instrumentation_tests_for_apk { |
303 local APK=${1} | 319 local APK=${1} |
304 local APK_PACKAGE=${2} | 320 local APK_PACKAGE=${2} |
305 local TEST_APK=${3} | 321 local TEST_APK=${3} |
306 | 322 |
307 # Install application APK. | 323 # Install application APK. |
308 python build/android/adb_install_apk.py --apk ${APK} \ | 324 bb_install_apk ${APK} ${APK_PACKAGE} |
309 --apk_package ${APK_PACKAGE} | |
310 | 325 |
311 # Run instrumentation tests. Using -I to install the test apk. | 326 # Run instrumentation tests. Using -I to install the test apk. |
| 327 echo "@@@BUILD_STEP Run instrumentation tests ${TEST_APK}@@@" |
312 bb_run_step python build/android/run_instrumentation_tests.py \ | 328 bb_run_step python build/android/run_instrumentation_tests.py \ |
313 -vvv --test-apk ${TEST_APK} -I | 329 -vvv --test-apk ${TEST_APK} -I |
314 } | 330 } |
315 | 331 |
316 # Run instrumentation tests for all relevant APKs on device. | 332 # Run instrumentation tests for all relevant APKs on device. |
317 function bb_run_instrumentation_tests { | 333 function bb_run_instrumentation_tests { |
318 bb_run_all_instrumentation_tests_for_apk "ContentShell.apk" \ | 334 bb_run_all_instrumentation_tests_for_apk "ContentShell.apk" \ |
319 "org.chromium.content_shell" "ContentShellTest" | 335 "org.chromium.content_shell" "ContentShellTest" |
320 bb_run_all_instrumentation_tests_for_apk "ChromiumTestShell.apk" \ | 336 bb_run_all_instrumentation_tests_for_apk "ChromiumTestShell.apk" \ |
321 "org.chromium.chrome.testshell" "ChromiumTestShellTest" | 337 "org.chromium.chrome.testshell" "ChromiumTestShellTest" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 ) | 406 ) |
391 } | 407 } |
392 | 408 |
393 # Retrieve a packed json property using python | 409 # Retrieve a packed json property using python |
394 function bb_get_json_prop { | 410 function bb_get_json_prop { |
395 local JSON="$1" | 411 local JSON="$1" |
396 local PROP="$2" | 412 local PROP="$2" |
397 | 413 |
398 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 414 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
399 } | 415 } |
OLD | NEW |