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

Unified Diff: image_to_vm.sh

Issue 5271010: Factored out the code to copy an image and modify it for test (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Final upload to check before push Created 9 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 | « image_to_usb.sh ('k') | mod_image_for_test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: image_to_vm.sh
diff --git a/image_to_vm.sh b/image_to_vm.sh
index dff302303f5caef887837550b14883efca73b17f..b517bc102c4f3a55cd375a4cf695c4968ece0194 100755
--- a/image_to_vm.sh
+++ b/image_to_vm.sh
@@ -47,7 +47,10 @@ DEFINE_boolean factory $FLAGS_FALSE \
"Modify the image for manufacturing testing"
DEFINE_boolean factory_install $FLAGS_FALSE \
"Modify the image for factory install shim"
-DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image"
+
+# We default to TRUE so the buildbot gets its image. Note this is different
+# behavior from image_to_usb.sh
+DEFINE_boolean force_copy ${FLAGS_TRUE} "Always rebuild test image"
DEFINE_string format "qemu" \
"Output format, either qemu, vmware or virtualbox"
DEFINE_string from "" \
@@ -64,7 +67,7 @@ DEFINE_string state_image "" \
DEFINE_integer statefulfs_size 2048 \
"Stateful partition size in MBs."
DEFINE_boolean test_image "${FLAGS_FALSE}" \
- "Copies normal image to chromiumos_test_image.bin, modifies it for test."
+ "Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test."
DEFINE_string to "" \
"Destination folder for VM output file(s)"
DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \
@@ -108,39 +111,13 @@ if [ -z "${FLAGS_to}" ] ; then
FLAGS_to="${FLAGS_from}"
fi
-# Use this image as the source image to copy
-SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
-
-# If we're asked to modify the image for test, then let's make a copy and
-# modify that instead.
if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then
- if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \
- [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then
- # Copy it.
- echo "Creating test image from original..."
- cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin"
-
- # Check for manufacturing image.
- if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
- EXTRA_ARGS="--factory"
- fi
-
- # Check for install shim.
- if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
- EXTRA_ARGS="--factory_install"
- fi
-
- # Modify it. Pass --yes so that mod_image_for_test.sh won't ask us if we
- # really want to modify the image; the user gave their assent already with
- # --test-image and the original image is going to be preserved.
- "${SCRIPTS_DIR}/mod_image_for_test.sh" --board=${FLAGS_board} --image \
- "${FLAGS_from}/chromiumos_test_image.bin" ${EXTRA_ARGS} --yes
- echo "Done with mod_image_for_test."
- else
- echo "Using cached test image."
- fi
- SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin"
- echo "Source test image is: ${SRC_IMAGE}"
+ # Make a test image - this returns the test filename in CHROMEOS_RETURN_VAL
+ prepare_test_image "${FLAGS_from}" "${CHROMEOS_IMAGE_NAME}"
+ SRC_IMAGE="${CHROMEOS_RETURN_VAL}"
+else
+ # Use the standard image
+ SRC_IMAGE="${FLAGS_from}/${CHROMEOS_IMAGE_NAME}"
fi
# Memory units are in MBs
« no previous file with comments | « image_to_usb.sh ('k') | mod_image_for_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698