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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 instrumentation test. |
211 # Args: | 211 # Args: |
212 # $1: TEST_APK. | 212 # $1: TEST_APK. |
213 # $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py. | 213 # $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py. |
214 function bb_run_instrumentation_test { | 214 function bb_run_instrumentation_test { |
215 ( | |
215 local TEST_APK=${1} | 216 local TEST_APK=${1} |
216 local EXTRA_FLAGS=${2} | 217 local EXTRA_FLAGS=${2} |
217 local INSTRUMENTATION_FLAGS="-vvv" | 218 local INSTRUMENTATION_FLAGS="-vvv" |
218 INSTRUMENTATION_FLAGS+=" --test-apk ${TEST_APK}" | 219 INSTRUMENTATION_FLAGS+=" --test-apk ${TEST_APK}" |
219 INSTRUMENTATION_FLAGS+=" ${EXTRA_FLAGS}" | 220 INSTRUMENTATION_FLAGS+=" ${EXTRA_FLAGS}" |
220 build/android/run_instrumentation_tests.py ${INSTRUMENTATION_FLAGS} | 221 set +e |
bulach
2012/10/02 10:40:46
I'm not terribly familiar with bash, but is a "set
klundberg
2012/10/02 18:40:06
I discussed this with Isaac and we don't need "set
| |
222 python build/android/run_instrumentation_tests.py ${INSTRUMENTATION_FLAGS} | |
223 local TEST_RUN_EXIT_CODE=$? | |
224 if (( $TEST_RUN_EXIT_CODE != 0 )); then | |
Isaac (away)
2012/10/02 05:13:37
use a [[ ]] test here
klundberg
2012/10/02 18:40:06
Done.
| |
225 echo "@@@STEP_FAILURE@@@" | |
226 fi | |
227 # Regardless of whether tests failed or crashed we don't want to stop the | |
228 # entire buildbot flow. | |
229 return 0 | |
Isaac (away)
2012/10/02 05:13:37
return is not technically necessary here but it's
klundberg
2012/10/02 18:40:06
Done.
| |
230 ) | |
221 } | 231 } |
222 | 232 |
223 # Run content shell instrumentation test on device. | 233 # Run instrumentation test. |
224 function bb_run_instrumentation_tests { | 234 # Args: |
225 build/android/adb_install_content_shell | 235 # $1: TEST_APK. |
226 local TEST_APK="ContentShellTest" | 236 # $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py. |
bulach
2012/10/02 10:40:46
nit: $3: ... ? :)
klundberg
2012/10/02 18:40:06
Done.
| |
237 function bb_run_instrumentation_tests_apk { | |
238 local APK=${1} | |
239 local TEST_APK=${2} | |
240 local APK_PACKAGE=${3} | |
241 echo ${1} ${2} ${3} | |
242 python build/android/adb_install_apk.py --apk ${APK} \ | |
243 --apk_package ${APK_PACKAGE} | |
244 | |
227 # Use -I to install the test apk only on the first run. | 245 # Use -I to install the test apk only on the first run. |
228 # TODO(bulach): remove the second once we have a Smoke test. | 246 # TODO(bulach): remove the second once we have a Smoke test. |
229 bb_run_instrumentation_test ${TEST_APK} "-I -A Smoke" | 247 bb_run_instrumentation_test ${TEST_APK} "-I -A Smoke" |
230 bb_run_instrumentation_test ${TEST_APK} "-I -A SmallTest" | 248 bb_run_instrumentation_test ${TEST_APK} "-I -A SmallTest" |
231 bb_run_instrumentation_test ${TEST_APK} "-A MediumTest" | 249 bb_run_instrumentation_test ${TEST_APK} "-A MediumTest" |
232 bb_run_instrumentation_test ${TEST_APK} "-A LargeTest" | 250 bb_run_instrumentation_test ${TEST_APK} "-A LargeTest" |
233 } | 251 } |
234 | 252 |
253 # Run content shell instrumentation test on device. | |
254 function bb_run_instrumentation_tests { | |
bulach
2012/10/02 10:40:46
hmm, these three methods sound too similar..
would
klundberg
2012/10/02 18:40:06
I discussed this with Isaac and since we don't car
| |
255 bb_run_instrumentation_tests_apk "ContentShell-debug.apk" \ | |
256 "ContentShellTest" "org.chromium.content_shell" | |
257 bb_run_instrumentation_tests_apk "ChromiumTestShell-debug.apk" \ | |
258 "ChromiumTestShellTest" "org.chromium.chrome.browser" | |
259 bb_run_instrumentation_tests_apk "AndroidWebView-debug.apk" \ | |
260 "AndroidWebViewTest" "org.chromium.android_webview" | |
261 } | |
262 | |
235 # Zip and archive a build. | 263 # Zip and archive a build. |
236 function bb_zip_build { | 264 function bb_zip_build { |
237 echo "@@@BUILD_STEP Zip build@@@" | 265 echo "@@@BUILD_STEP Zip build@@@" |
238 python ../../../../scripts/slave/zip_build.py \ | 266 python ../../../../scripts/slave/zip_build.py \ |
239 --src-dir "$SRC_ROOT" \ | 267 --src-dir "$SRC_ROOT" \ |
240 --exclude-files "lib.target,gen,android_webview,jingle_unittests" \ | 268 --exclude-files "lib.target,gen,android_webview,jingle_unittests" \ |
241 --factory-properties "$FACTORY_PROPERTIES" \ | 269 --factory-properties "$FACTORY_PROPERTIES" \ |
242 --build-properties "$BUILD_PROPERTIES" | 270 --build-properties "$BUILD_PROPERTIES" |
243 } | 271 } |
244 | 272 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 ) | 327 ) |
300 } | 328 } |
301 | 329 |
302 # Retrieve a packed json property using python | 330 # Retrieve a packed json property using python |
303 function bb_get_json_prop { | 331 function bb_get_json_prop { |
304 local JSON="$1" | 332 local JSON="$1" |
305 local PROP="$2" | 333 local PROP="$2" |
306 | 334 |
307 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 335 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
308 } | 336 } |
OLD | NEW |