Chromium Code Reviews| Index: sync_build_test.sh |
| diff --git a/sync_build_test.sh b/sync_build_test.sh |
| index 9473205e67b926c8c2dae4a7c070545aab16a411..7454dbac8f7971eea7c1f0dd577fb401b80d7a34 100755 |
| --- a/sync_build_test.sh |
| +++ b/sync_build_test.sh |
| @@ -62,6 +62,8 @@ DEFINE_boolean force_make_chroot ${FLAGS_FALSE} "Run make_chroot indep of sync" |
| DEFINE_string grab_buildbot "" \ |
| "Instead of building, grab this full image.zip URI generated by the \ |
| buildbot" |
| +DEFINE_boolean ignore_remote_test_failures ${FLAGS_FALSE} \ |
| + "Ignore any remote tests that failed and don't return failure" |
| DEFINE_boolean image_to_live ${FLAGS_FALSE} \ |
| "Put the resulting image on live instance (requires --remote)" |
| DEFINE_string image_to_usb "" \ |
| @@ -183,6 +185,7 @@ function validate_and_set_param_defaults() { |
| fi |
| FLAGS_sync=${FLAGS_FALSE} |
| FLAGS_build=${FLAGS_FALSE} |
| + FLAGS_unittest=${FLAGS_FALSE} |
| FLAGS_master=${FLAGS_FALSE} |
| fi |
| @@ -450,8 +453,13 @@ EOF |
| # Downloads a buildbot image |
| function grab_buildbot() { |
| + read -p "Username [${LOGNAME}]: " GSDCURL_USERNAME |
| + export GSDCURL_USERNAME |
| + read -s -p "Password: " GSDCURL_PASSWORD |
| + export GSDCURL_PASSWORD |
| + CURL="$(dirname $0)/bin/cros_gsdcurl.py" |
| if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then |
| - local latest=$(curl "${FLAGS_buildbot_uri}/LATEST") |
| + local latest=$(${CURL} "${FLAGS_buildbot_uri}/LATEST") |
| if [[ -z "${latest}" ]]; then |
| echo "Error finding latest." |
| exit 1 |
| @@ -459,9 +467,14 @@ function grab_buildbot() { |
| FLAGS_grab_buildbot="${FLAGS_buildbot_uri}/${latest}/image.zip" |
| fi |
| local dl_dir=$(mktemp -d "/tmp/image.XXXX") |
| + |
| echo "Grabbing image from ${FLAGS_grab_buildbot} to ${dl_dir}" |
| - run_phase "Downloading image" curl "${FLAGS_grab_buildbot}" \ |
| - -o "${dl_dir}/image.zip" |
| + run_phase "Downloading image" ${CURL} "${FLAGS_grab_buildbot}" \ |
| + -o "${dl_dir}/image.zip" |
| + # Clear out the credentials so they can't be used later. |
|
petkov
2010/09/24 21:35:37
You should probably do this in the failure() funct
|
| + export GSDCURL_USERNAME="" |
| + export GSDCURL_PASSWORD="" |
| + |
| cd "${dl_dir}" |
| unzip image.zip |
| local image_basename=$(basename $(dirname "${FLAGS_grab_buildbot}")) |
| @@ -474,6 +487,16 @@ function grab_buildbot() { |
| run_phase "Installing buildbot test modified image" \ |
| mv chromiumos_test_image.bin "${image_dir}/chromiumos_image.bin" |
| FLAGS_mod_image_for_test=${FLAGS_FALSE} |
| + else |
| + run_phase "Installing buildbot base image" \ |
| + mv chromiumos_base_image.bin "${image_dir}/chromiumos_image.bin" |
| + fi |
| + |
| + if [[ -n "${FLAGS_test}" ]]; then |
| + if [[ ! -d "${FLAGS_top}/chroot/build/${FLAGS_board}" ]]; then |
| + echo "To run tests on a buildbot image, run setup_board first." |
|
petkov
2010/09/24 21:35:37
die?
|
| + exit 1 |
| + fi |
| if [[ -e "autotest.tgz" || -e "autotest.tar.bz2" ]]; then |
| # pull in autotest |
| local dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local" |
| @@ -491,8 +514,6 @@ function grab_buildbot() { |
| run_phase "Installing buildbot autotest cross-compiled binaries" \ |
| sudo mv autotest ${dir} |
| fi |
| - else |
| - mv chromiumos_image.bin "${image_dir}" |
| fi |
| chdir_relative . |
| run_phase "Removing downloaded image" rm -rf "${dl_dir}" |
| @@ -569,16 +590,6 @@ function main() { |
| local build_autotest_param="" |
| if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then |
| build_autotest_param="--withautotest" |
| - if [[ ${FLAGS_useworkon} -eq ${FLAGS_TRUE} ]]; then |
| - # In workon flow, you must workon packages to run tests |
| - run_phase_in_chroot "Setting workon for autotest" \ |
| - ./cros_workon --board=${FLAGS_board} start autotest \ |
| - autotest-tests autotest-deps |
| - # In minilayout you may not yet have autotest. |
| - if [[ ! -d "${FLAGS_top}/src/third_party/autotest/files" ]]; then |
| - run_phase "Syncing autotest repo" repo sync autotest |
| - fi |
| - fi |
| fi |
| run_phase_in_chroot "Building packages" \ |
| @@ -595,6 +606,7 @@ function main() { |
| if [[ ${FLAGS_unittest} -eq ${FLAGS_TRUE} ]] && [[ "${FLAGS_board}" == \ |
| "x86-generic" ]] ; then |
| + chdir_relative src/scripts |
| run_phase_in_chroot "Running unit tests" ./cros_run_unit_tests \ |
| ${board_param} |
| fi |
| @@ -633,9 +645,14 @@ function main() { |
| chdir_relative src/scripts |
| # We purposefully do not quote FLAGS_test below as we expect it may |
| # have multiple parameters |
| - run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ |
| + if ! run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ |
| ./run_remote_tests.sh "--remote=${FLAGS_remote}" ${FLAGS_test} \ |
| - "${board_param}" |
| + "${board_param}"; then |
| + if [[ ${FLAGS_ignore_remote_test_failures} -eq ${FLAGS_FALSE} ]]; then |
| + echo "Remote tests failed and --ignore_remote_test_failures not passed" |
| + false |
| + fi |
| + fi |
| fi |
| trap - EXIT |