From fe70255de8e8d185c6f6972e216b9cbe0401466a Mon Sep 17 00:00:00 2001 From: Lluis Campos Date: Tue, 20 Oct 2020 14:06:59 +0200 Subject: [PATCH] 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 --- mender-convert | 4 ++-- scripts/test/run-tests.sh | 41 ++++++-------------------------------- scripts/test/test-utils.sh | 8 -------- 3 files changed, 8 insertions(+), 45 deletions(-) diff --git a/mender-convert b/mender-convert index 015093b..09cbfaf 100755 --- a/mender-convert +++ b/mender-convert @@ -123,10 +123,10 @@ parse_cli_options "$@" compression_type=$(compression_type "${disk_image}") if [[ ${compression_type} != "none" ]]; then 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}" fi +echo "MENDER_COMPRESS_DISK_IMAGE=${compression_type}" > ${ocfile} +prepend_extraargs="--config ${ocfile}" ./mender-convert-extract ${prepend_extraargs} "$@" ${append_extraargs} ./mender-convert-modify ${prepend_extraargs} "$@" ${append_extraargs} diff --git a/scripts/test/run-tests.sh b/scripts/test/run-tests.sh index f951f28..166b1b1 100755 --- a/scripts/test/run-tests.sh +++ b/scripts/test/run-tests.sh @@ -61,10 +61,12 @@ else echo >&2 "----------------------------------------" rm -rf deploy gunzip --force "input/Ubuntu-Bionic-x86-64.img.gz" - convert_and_test "qemux86_64" \ - "release-1" \ - "input/Ubuntu-Bionic-x86-64.img" \ - "--config configs/qemux86-64_config" || test_result=$? + run_convert "release-2" \ + "input/Ubuntu-Bionic-x86-64.img" \ + "--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 if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "raspberrypi3" ]; then @@ -73,16 +75,6 @@ else "release-1" \ "input/2019-09-26-raspbian-buster-lite.zip" \ "--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 if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "linaro-alip" ]; then @@ -101,17 +93,6 @@ else "release-1" \ "input/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz" \ "--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 if [ "$1" == "--all" -o "$1" == "--only" -a "$2" == "ubuntu" ]; then @@ -120,16 +101,6 @@ else "release-1" \ "input/ubuntu-18.04.5-preinstalled-server-armhf+raspi3.img.xz" \ "--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 exit $test_result diff --git a/scripts/test/test-utils.sh b/scripts/test/test-utils.sh index 902cd60..fc58502 100644 --- a/scripts/test/test-utils.sh +++ b/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" 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 # in the test-infrastructure. for file in ${MENDER_CONVERT_DIR}/deploy/*.img; do