mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 22:16:58 +02:00
Only allows mod_image_for_test for default from behavior.
BUG=1970 TEST=Running archive build with clean build and producing a test image and normal image and zip file. Also running with custom from and getting an error code with test_mod=true This change is required because mod_image_for_test requires it to be inside chroot. Since the buildbot is the main user of this script, this deals with that use case. Other users of this script will have to run mod_image_for_test manually outside of archive_build Review URL: http://codereview.chromium.org/2008001
This commit is contained in:
parent
18e38c33e6
commit
3adaa549e0
@ -38,16 +38,28 @@ DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes"
|
|||||||
FLAGS "$@" || exit 1
|
FLAGS "$@" || exit 1
|
||||||
eval set -- "${FLAGS_ARGV}"
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
|
# Set if default from path is used
|
||||||
|
DEFAULT_USED=
|
||||||
|
|
||||||
# Reset "default" FLAGS_from based on passed-in board if not set on cmd-line
|
# Reset "default" FLAGS_from based on passed-in board if not set on cmd-line
|
||||||
if [ "$FLAGS_from" = "$DEFAULT_FROM" ]
|
if [ "$FLAGS_from" = "$DEFAULT_FROM" ]
|
||||||
then
|
then
|
||||||
FLAGS_from="${IMAGES_DIR}/$FLAGS_board/$(ls -t1 \
|
FLAGS_from="${IMAGES_DIR}/$FLAGS_board/$(ls -t1 \
|
||||||
$IMAGES_DIR/$FLAGS_board 2>&-| head -1)"
|
$IMAGES_DIR/$FLAGS_board 2>&-| head -1)"
|
||||||
|
DEFAULT_USED=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Die on any errors.
|
# Die on any errors.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if [ -z $DEFAULT_USED ] && [ $FLAGS_test_mod -eq $FLAGS_TRUE ]
|
||||||
|
then
|
||||||
|
echo "test_mod requires that the default from path be used."
|
||||||
|
echo "If non default behavior is desired, run mod_image_for_test manually"
|
||||||
|
echo "re-run archive build without test_mod"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d "$FLAGS_from" ]
|
if [ ! -d "$FLAGS_from" ]
|
||||||
then
|
then
|
||||||
echo "$FLAGS_from does not exist. Exiting..."
|
echo "$FLAGS_from does not exist. Exiting..."
|
||||||
@ -94,10 +106,10 @@ if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]
|
|||||||
then
|
then
|
||||||
echo "Modifying image for test"
|
echo "Modifying image for test"
|
||||||
SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
|
SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
|
||||||
cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin"
|
cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_image_bkup.bin"
|
||||||
SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin"
|
./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board --yes
|
||||||
"${SCRIPTS_DIR}/mod_image_for_test.sh" --board $FLAGS_board --yes --image \
|
mv "$SRC_IMAGE" "${FLAGS_from}/chromiumos_test_image.bin"
|
||||||
"${SRC_IMAGE}"
|
mv "${FLAGS_from}/chromiumos_image_bkup.bin" "$SRC_IMAGE"
|
||||||
cd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local"
|
cd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local"
|
||||||
echo "Archiving autotest build artifacts"
|
echo "Archiving autotest build artifacts"
|
||||||
tar cjf "${FLAGS_from}/autotest.tar.bz2" autotest
|
tar cjf "${FLAGS_from}/autotest.tar.bz2" autotest
|
||||||
|
Loading…
Reference in New Issue
Block a user