Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1452)

Unified Diff: src/scripts/mod_image_for_test.sh

Issue 656023: Changes to use default board when set by setup_board (Closed)
Patch Set: Fix build_autotest Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scripts/image_to_usb.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/mod_image_for_test.sh
diff --git a/src/scripts/mod_image_for_test.sh b/src/scripts/mod_image_for_test.sh
index c544732462db6f8beb78fe135b76ead443820906..e6982a1fc1d567ee21519eb6ecca2fb3899be793 100755
--- a/src/scripts/mod_image_for_test.sh
+++ b/src/scripts/mod_image_for_test.sh
@@ -10,21 +10,34 @@
# The path to common.sh should be relative to your script's location.
. "$(dirname "$0")/common.sh"
-DEFAULT_BOARD=x86-generic
-IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${DEFAULT_BOARD}"
-DEFAULT_IMAGE="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image"
+get_default_board
DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built"
-DEFINE_string image "$DEFAULT_IMAGE" \
- "Location of the rootfs raw image file"
+DEFINE_string image "" "Location of the rootfs raw image file"
DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y"
# Parse command line
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
-IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${DEFAULT_BOARD}"
-DEFAULT_IMAGE="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image"
+# No board, no default and no image set then we can't find the image
+if [ -z $FLAGS_IMAGE ] && [ -z $FLAGS_board ] ; then
+ setup_board_warning
+ echo "*** mod_image_for_test failed. No board set and no image set"
+ exit 1
+fi
+
+# We have a board name but no image set. Use image at default location
+if [ -z $FLAGS_image ] ; then
+ IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
+ FLAGS_image="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/rootfs.image"
+fi
+
+# Abort early if we can't find the image
+if [ ! -f $FLAGS_image ] ; then
+ echo "No image found at $FLAGS_image"
+ exit 1
+fi
# Make sure anything mounted in the rootfs is cleaned up ok on exit.
cleanup_rootfs_mounts() {
« no previous file with comments | « src/scripts/image_to_usb.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698