Browse Source

Do not compress output image for uncompressed input image

Respecting this way always the input type (compressed or not) by
default, allowing the user to override behaviour if desired.

For the tests, removed the unnecessary duplication on rerunning all
tests on uncompressed versions, and added instead an explicit test only
for qemu-x86_64.

Changelog: Title

Signed-off-by: Lluis Campos <lluis.campos@northern.tech>
2.3.x
Lluis Campos 4 years ago
parent
commit
fe70255de8
  1. 4
      mender-convert
  2. 37
      scripts/test/run-tests.sh
  3. 8
      scripts/test/test-utils.sh

4
mender-convert

@ -123,10 +123,10 @@ parse_cli_options "$@"
compression_type=$(compression_type "${disk_image}") compression_type=$(compression_type "${disk_image}")
if [[ ${compression_type} != "none" ]]; then if [[ ${compression_type} != "none" ]]; then
uncompressed_disk_image=$(decompress_image "${disk_image}" "./work") uncompressed_disk_image=$(decompress_image "${disk_image}" "./work")
echo "MENDER_COMPRESS_DISK_IMAGE=${compression_type}" > ${ocfile}
prepend_extraargs="--config ${ocfile}"
append_extraargs="--disk-image ${uncompressed_disk_image}" append_extraargs="--disk-image ${uncompressed_disk_image}"
fi fi
echo "MENDER_COMPRESS_DISK_IMAGE=${compression_type}" > ${ocfile}
prepend_extraargs="--config ${ocfile}"
./mender-convert-extract ${prepend_extraargs} "$@" ${append_extraargs} ./mender-convert-extract ${prepend_extraargs} "$@" ${append_extraargs}
./mender-convert-modify ${prepend_extraargs} "$@" ${append_extraargs} ./mender-convert-modify ${prepend_extraargs} "$@" ${append_extraargs}

37
scripts/test/run-tests.sh

@ -61,10 +61,12 @@ else
echo >&2 "----------------------------------------" echo >&2 "----------------------------------------"
rm -rf deploy rm -rf deploy
gunzip --force "input/Ubuntu-Bionic-x86-64.img.gz" gunzip --force "input/Ubuntu-Bionic-x86-64.img.gz"
convert_and_test "qemux86_64" \ run_convert "release-2" \
"release-1" \
"input/Ubuntu-Bionic-x86-64.img" \ "input/Ubuntu-Bionic-x86-64.img" \
"--config configs/qemux86-64_config" || test_result=$? "--config configs/qemux86-64_config" || test_result=$?
ret=0
test -f deploy/Ubuntu-Bionic-x86-64-qemux86_64-mender.img || ret=$?
assert "${ret}" "0" "Expected uncompressed file deploy/Ubuntu-Bionic-x86-64-qemux86_64-mender.img"
fi fi
if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "raspberrypi3" ]; then if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "raspberrypi3" ]; then
@ -73,16 +75,6 @@ else
"release-1" \ "release-1" \
"input/2019-09-26-raspbian-buster-lite.zip" \ "input/2019-09-26-raspbian-buster-lite.zip" \
"--config configs/raspberrypi3_config" || test_result=$? "--config configs/raspberrypi3_config" || test_result=$?
echo >&2 "----------------------------------------"
echo >&2 "Running the uncompressed test"
echo >&2 "----------------------------------------"
rm -rf deploy
unzip -o "input/2019-09-26-raspbian-buster-lite.zip" -d "./input"
convert_and_test "raspberrypi3" \
"release-1" \
"input/2019-09-26-raspbian-buster-lite.img" \
"--config configs/raspberrypi3_config" || test_result=$?
fi fi
if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "linaro-alip" ]; then if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "linaro-alip" ]; then
@ -101,17 +93,6 @@ else
"release-1" \ "release-1" \
"input/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz" \ "input/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz" \
"--config configs/beaglebone_black_debian_sdcard_config" || test_result=$? "--config configs/beaglebone_black_debian_sdcard_config" || test_result=$?
echo >&2 "----------------------------------------"
echo >&2 "Running the uncompressed test"
echo >&2 "----------------------------------------"
rm -rf deploy
wget --progress=dot:giga -N ${BBB_DEBIAN_EMMC_IMAGE_URL} -P input/
unxz --force "input/bone-debian-10.5-console-armhf-2020-09-21-1gb.img.xz"
convert_and_test "beaglebone-emmc" \
"release-1" \
"input/bone-debian-10.5-console-armhf-2020-09-21-1gb.img" \
"--config configs/beaglebone_black_debian_emmc_config" || test_result=$?
fi fi
if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "ubuntu" ]; then if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "ubuntu" ]; then
@ -120,16 +101,6 @@ else
"release-1" \ "release-1" \
"input/ubuntu-18.04.5-preinstalled-server-armhf+raspi3.img.xz" \ "input/ubuntu-18.04.5-preinstalled-server-armhf+raspi3.img.xz" \
"--config configs/raspberrypi3_config" || test_result=$? "--config configs/raspberrypi3_config" || test_result=$?
echo >&2 "----------------------------------------"
echo >&2 "Running the uncompressed test"
echo >&2 "----------------------------------------"
rm -rf deploy
unxz --force "input/ubuntu-18.04.5-preinstalled-server-armhf+raspi3.img.xz"
convert_and_test "raspberrypi3" \
"release-1" \
"input/ubuntu-18.04.5-preinstalled-server-armhf+raspi3.img" \
"--config configs/raspberrypi3_config" || test_result=$?
fi fi
exit $test_result exit $test_result

8
scripts/test/test-utils.sh

@ -105,14 +105,6 @@ run_tests() {
html_report_args="--html=${MENDER_CONVERT_DIR}/report_${device_type}.html --self-contained-html" html_report_args="--html=${MENDER_CONVERT_DIR}/report_${device_type}.html --self-contained-html"
fi fi
# Need to decompress images built with MENDER_COMPRESS_DISK_IMAGE=gzip before
# running tests.
if [ -f "deploy/${converted_image_name}.img.gz" ]; then
# sudo is needed because the image is created using docker-mender-convert
# which sets root permissions on the image
sudo gunzip --force "deploy/${converted_image_name}.img.gz"
fi
# MEN-3051: Rename the files back to .sdimg, as the sdimg extension has meaning # MEN-3051: Rename the files back to .sdimg, as the sdimg extension has meaning
# in the test-infrastructure. # in the test-infrastructure.
for file in ${MENDER_CONVERT_DIR}/deploy/*.img; do for file in ${MENDER_CONVERT_DIR}/deploy/*.img; do

Loading…
Cancel
Save