Index: sync_build_test.sh |
diff --git a/sync_build_test.sh b/sync_build_test.sh |
index 16934419c09be0160100a26c45d2d69a657aca81..046ff19eaa6663fecc20e3560c5db40801d66db8 100755 |
--- a/sync_build_test.sh |
+++ b/sync_build_test.sh |
@@ -44,9 +44,10 @@ |
# Load common constants. This should be the first executable line. |
# The path to common.sh should be relative to your script's location. |
. "$(dirname "$0")/common.sh" |
+# Allow remote access (for learning board type) |
+. "$(dirname "$0")/remote_access.sh" |
- |
-DEFINE_string board "x86-generic" "Board setting" |
+DEFINE_string board "" "Board setting" |
DEFINE_boolean build ${FLAGS_TRUE} \ |
"Build all code (but not necessarily master image)" |
DEFINE_boolean build_autotest ${FLAGS_FALSE} "Build autotest" |
@@ -78,8 +79,6 @@ DEFINE_integer jobs -1 "Concurrent build jobs" |
DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" |
DEFINE_boolean minilayout ${FLAGS_FALSE} "Use minimal code checkout" |
DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" |
-DEFINE_string remote "" \ |
- "Use this hostname/IP for live updating and running tests" |
DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" |
DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" |
DEFINE_string test "" \ |
@@ -104,6 +103,8 @@ function is_google_environment() { |
# Validates parameters and sets "intelligent" defaults based on other |
# parameters. |
function validate_and_set_param_defaults() { |
+ TMP=$(mktemp -d "/tmp/sync_build_test.XXXX") |
+ |
if [[ -z "${FLAGS_top}" ]]; then |
local test_dir=$(pwd) |
while [[ "${test_dir}" != "/" ]]; do |
@@ -174,6 +175,16 @@ function validate_and_set_param_defaults() { |
# update. |
if [[ -n "${FLAGS_remote}" ]]; then |
FLAGS_image_to_live=${FLAGS_TRUE} |
+ remote_access_init |
+ fi |
+ |
+ # Figure out board. |
+ if [[ -z "${FLAGS_board}" ]]; then |
+ if [[ -n "${FLAGS_remote}" ]]; then |
+ learn_board |
+ else |
+ FLAGS_board="${DEFAULT_BOARD}" |
+ fi |
fi |
# Grabbing a buildbot build is exclusive with syncing and building |
@@ -340,6 +351,10 @@ function describe_phase() { |
echo "#" |
} |
+function cleanup() { |
+ [ -n "${TMP}" ] && rm -rf "${TMP}" |
+ cleanup_remote_access |
+} |
# Called when there is a failure and we exit early |
function failure() { |
@@ -349,6 +364,7 @@ function failure() { |
export GSDCURL_PASSWORD="" |
describe_phase "Failure during: ${LAST_PHASE}" |
show_duration |
+ cleanup |
} |
@@ -471,7 +487,7 @@ function grab_buildbot() { |
fi |
FLAGS_grab_buildbot="${FLAGS_buildbot_uri}/${latest}/image.zip" |
fi |
- local dl_dir=$(mktemp -d "/tmp/image.XXXX") |
+ local dl_dir="${TMP}/image" |
echo "Grabbing image from ${FLAGS_grab_buildbot} to ${dl_dir}" |
run_phase "Downloading image" ${CURL} "${FLAGS_grab_buildbot}" \ |
@@ -580,6 +596,11 @@ function main() { |
fi |
if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then |
+ # It's necessary to enable localaccount for BVT tests to pass. |
+ chdir_relative src/scripts |
+ run_phase "Enable local account" \ |
+ ./enable_localaccount.sh chronos "${FLAGS_chroot}" |
+ |
local pkg_param="" |
if [[ ${FLAGS_usepkg} -eq ${FLAGS_FALSE} ]]; then |
pkg_param="--nousepkg" |
@@ -663,7 +684,7 @@ function main() { |
fi |
fi |
- trap - EXIT |
+ trap cleanup EXIT |
echo "Successfully used ${FLAGS_top} to:" |
describe_steps |
show_duration |