diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6ab48f..210ced1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,13 @@ image: docker:git variables: DOCKER_REPOSITORY: mendersoftware/mender-convert + S3_BUCKET_NAME: mender-convert-images + MENDER_ARTIFACT_VERSION: master + MENDER_CLIENT_VERSION: master + RASPBIAN_URL: http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip + RASPBIAN_NAME: 2019-09-26-raspbian-buster-lite + + DEBIAN_FRONTEND: noninteractive include: - project: 'Northern.tech/Mender/mendertesting' @@ -12,14 +19,16 @@ include: stages: - test - build + - convert - test_acceptance + - publish build: stage: build services: - docker:dind script: - - IMAGE_NAME=$DOCKER_REPOSITORY:pr ./docker-build + - IMAGE_NAME=$DOCKER_REPOSITORY:pr ./docker-build --build-arg MENDER_ARTIFACT_VERSION=${MENDER_ARTIFACT_VERSION} - docker save $DOCKER_REPOSITORY:pr > image.tar artifacts: expire_in: 2w @@ -28,27 +37,34 @@ build: test_acceptance: stage: test_acceptance - image: docker:18-dind + image: teracy/ubuntu:18.04-dind-18.09.9 + services: + - docker:18-dind tags: - mender-qa-slave dependencies: - build + - convert_raspbian + timeout: 2h before_script: - # Start up Docker (DonD) - - /usr/local/bin/dockerd-entrypoint.sh & - - sleep 10 - - export DOCKER_HOST="unix:///var/run/docker.sock" - - docker version # Install dependencies - - apk --update --no-cache add bash wget git util-linux mtools python3 py3-pip - gcc python3-dev libffi-dev lzo-dev libc-dev openssl-dev make sudo + - apt update + - apt install -qyy bash wget git util-linux mtools python3 python3-pip + gcc python3-dev libffi-dev liblzo2-dev libc-dev libssl-dev make sudo + awscli unzip # Python3 dependencies - pip3 install -r https://raw.githubusercontent.com/mendersoftware/meta-mender/master/tests/acceptance/requirements_py3.txt # Load image under test - export IMAGE_NAME=$DOCKER_REPOSITORY:pr - docker load -i image.tar + # Fetch artifacts from temporary S3 bucket + - aws s3 cp s3://mender-gitlab-tmp-storage/$CI_PROJECT_NAME/$CI_PIPELINE_ID/deploy.tar.gz deploy.tar.gz + - tar xzf deploy.tar.gz + # Extract converted Raspbian artifacts + - unxz deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.sdimg.xz script: - - ./scripts/run-tests.sh + - ./scripts/test/run-tests.sh --prebuilt-image raspberrypi ${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION} + - ./scripts/test/run-tests.sh --all artifacts: expire_in: 2w when: always @@ -57,3 +73,54 @@ test_acceptance: - report_*.html reports: junit: results_*.xml + +convert_raspbian: + stage: convert + image: teracy/ubuntu:18.04-dind-18.09.9 + services: + - docker:18-dind + tags: + - mender-qa-slave + dependencies: + - build + before_script: + - apt update && apt install -yy bash wget unzip awscli + + - export IMAGE_NAME=$DOCKER_REPOSITORY:pr + - docker load -i image.tar + + - wget -q ${RASPBIAN_URL} + - unzip ${RASPBIAN_NAME}.zip + + script: + - echo "MENDER_CLIENT_VERSION=${MENDER_CLIENT_VERSION}" > mender_client_version_config + - env MENDER_ARTIFACT_NAME=${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION} + ./docker-mender-convert -d ${RASPBIAN_NAME}.img + -c configs/raspberrypi3_config + -c configs/images/raspberrypi3_raspbian_config + -c mender_client_version_config + + # Upload to temporary S3 bucket + - tar czf deploy.tar.gz deploy + - aws s3 cp deploy.tar.gz s3://mender-gitlab-tmp-storage/$CI_PROJECT_NAME/$CI_PIPELINE_ID/deploy.tar.gz + +publish:s3: + when: manual + stage: publish + image: debian:buster + before_script: + - apt update && apt install -yyq awscli + + # Fetch artifacts from temporary S3 bucket + - aws s3 cp s3://mender-gitlab-tmp-storage/$CI_PROJECT_NAME/$CI_PIPELINE_ID/deploy.tar.gz deploy.tar.gz + - tar xzf deploy.tar.gz + + script: + - echo "Publishing ${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.img.xz version to S3" + # Prepare high privilege S3 keys (the base keys are for the tmp storage only) + - export AWS_ACCESS_KEY_ID=$PUBLISH_AWS_ACCESS_KEY_ID + - export AWS_SECRET_ACCESS_KEY=$PUBLISH_AWS_SECRET_ACCESS_KEY + - aws s3 cp deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.sdimg.xz + s3://$S3_BUCKET_NAME/${RASPBIAN_NAME}/arm/${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.img.xz + - aws s3api put-object-acl --acl public-read --bucket $S3_BUCKET_NAME + --key ${RASPBIAN_NAME}/arm/${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.img.xz diff --git a/Dockerfile b/Dockerfile index b19e133..3002abb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,17 @@ +# Build pxz in separate image to avoid big image size +FROM ubuntu:19.04 AS build +RUN apt-get update && apt-get install -y \ + build-essential \ + git \ + liblzma-dev + +# Parallel xz (LZMA) compression +RUN git clone https://github.com/jnovy/pxz.git /root/pxz +RUN cd /root/pxz && make + FROM ubuntu:19.04 -ARG MENDER_ARTIFACT_VERSION=3.1.0 +ARG MENDER_ARTIFACT_VERSION=3.2.1 RUN apt-get update && apt-get install -y \ # For 'ar' command to unpack .deb @@ -30,7 +41,11 @@ RUN apt-get update && apt-get install -y \ # to get rid of 'sh: 1: udevadm: not found' errors triggered by parted udev \ # to create bmap index file (MENDER_USE_BMAP) - bmap-tools + bmap-tools \ +# needed to run pxz + libgomp1 + +COPY --from=build /root/pxz/pxz /usr/bin/pxz RUN wget -q -O /usr/bin/mender-artifact https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/$MENDER_ARTIFACT_VERSION/linux/mender-artifact \ && chmod +x /usr/bin/mender-artifact diff --git a/configs/images/raspberrypi3_raspbian_config b/configs/images/raspberrypi3_raspbian_config new file mode 100644 index 0000000..f8d42d8 --- /dev/null +++ b/configs/images/raspberrypi3_raspbian_config @@ -0,0 +1,14 @@ +# Real life SD cards typically have less than they advertise. First off, they +# often use a base of 1000 instead of 1024, and even then they are often smaller +# than advertised. The number below is based on a conservative target of 3.9GB +# (that's mathematical GB, base 1000), converted to MiB, rounding down. +MENDER_STORAGE_TOTAL_SIZE_MB=3719 + +# Use all there is, which gets us almost, but not quite, to 500MiB free space +# (about 480MiB at the time of writing). +IMAGE_ROOTFS_SIZE=-1 +IMAGE_ROOTFS_EXTRA_SPACE=0 +IMAGE_OVERHEAD_FACTOR=1.0 + +# Best compression there is! +MENDER_COMPRESS_DISK_IMAGE=lzma diff --git a/configs/mender_convert_config b/configs/mender_convert_config index b056b74..9071ad1 100644 --- a/configs/mender_convert_config +++ b/configs/mender_convert_config @@ -4,12 +4,17 @@ # # NOTE! This file will always be sourced. -# Compress generated disk image using gzip +# Compress generated disk image # # This is useful when you have large disk images, compressing them # makes it easier to transfer them between e.g an build server and a local # machine, and obviously saves space. -MENDER_COMPRESS_DISK_IMAGE=y +# +# Possible values are: +# 'none' - No compression +# 'gzip' - Compress with gzip +# 'lzma' - Compress with xz (LZMA) +MENDER_COMPRESS_DISK_IMAGE=gzip # Compression algorithm for Mender Artifact # @@ -127,6 +132,41 @@ MENDER_USE_BMAP="n" # In most cases you would like this enabled. MENDER_COPY_BOOT_GAP="y" +# The size of each of the two rootfs filesystems, in KiB. If this is 0, +# mender-convert will use the size of the filesystem content as a basis. If the +# value is -1, mender-convert will use the maximum size that will fit inside the +# created partition. The size is further modified by IMAGE_ROOTFS_EXTRA_SPACE +# and IMAGE_OVERHEAD_FACTOR. +# +# This variable directly mirrors the variable from the Yocto Project, which is +# why it is missing a "MENDER_" prefix. +IMAGE_ROOTFS_SIZE="0" + +# The amount of extra free space requested on the rootfs, in KiB. This is added +# to the value of IMAGE_ROOTFS_SIZE. The size is further modified by +# IMAGE_OVERHEAD_FACTOR. +# +# Note that due to reserved space for the root user on the filesystem, "df" may +# report a significantly lower number than requested. A more accurate number can +# be fetched using for example "dumpe2fs" and looking for the "Free blocks" +# field, but even this value is usually going to be lower than requested due to +# meta data on the filesystem. +# +# This variable directly mirrors the variable from the Yocto Project, which is +# why it is missing a "MENDER_" prefix. +IMAGE_ROOTFS_EXTRA_SPACE="0" + +# This factor is multiplied by the used space value for the generated rootfs, +# and if the result is larger than IMAGE_ROOTFS_SIZE + IMAGE_ROOTFS_EXTRA_SPACE, +# it will be used as the size of the rootfs instead of the other two variables. +# +# The actual free space will usually be lower than requested. See comment for +# IMAGE_ROOTFS_EXTRA_SPACE. +# +# This variable directly mirrors the variable from the Yocto Project, which is +# why it is missing a "MENDER_" prefix. +IMAGE_OVERHEAD_FACTOR="1.5" + source configs/mender_grub_config # Function to create Mender Artifact diff --git a/docker-build b/docker-build index e0b5e03..8aa5f25 100755 --- a/docker-build +++ b/docker-build @@ -18,4 +18,4 @@ set -e IMAGE_NAME=${IMAGE_NAME:-mender-convert} -eval docker build . -t ${IMAGE_NAME} +eval docker build . -t ${IMAGE_NAME} "$@" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index bfc703d..092334d 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -23,3 +23,6 @@ cd /mender-convert echo "Running mender-convert "$@"" ./mender-convert "$@" + +# Set owner and group to same as launch directory. +[ -d deploy ] && chown -R --reference=. deploy diff --git a/mender-convert-package b/mender-convert-package index 1109a45..f52e668 100755 --- a/mender-convert-package +++ b/mender-convert-package @@ -140,17 +140,34 @@ artifact_name=$(cat work/rootfs/etc/mender/artifact_info | sed 's/[^=]*=//') image_name="${device_type}-${artifact_name}" -actual_rootfs_size=$(sudo du --apparent-size -s --block-size=512 work/rootfs | cut -f 1) +actual_rootfs_size=$(sudo du -s --block-size=512 work/rootfs | cut -f 1) -# 50 % free space, not to be confused with rootfs_part_sectors -rootfs_image_sectors=$(awk -v r1="$actual_rootfs_size" 'BEGIN{printf "%.0f", r1 * 1.50}') +# KiB -> 512 sectors +image_rootfs_size_sectors=$((${IMAGE_ROOTFS_SIZE} * 2)) + +if [ "${IMAGE_ROOTFS_SIZE}" -eq -1 ]; then + rootfs_image_sectors="${rootfs_part_sectors}" +elif [ "${image_rootfs_size_sectors}" -lt "${actual_rootfs_size}" ]; then + rootfs_image_sectors="${actual_rootfs_size}" +else + rootfs_image_sectors="${image_rootfs_size_sectors}" +fi + +rootfs_image_sectors=$((${rootfs_image_sectors} + ${IMAGE_ROOTFS_EXTRA_SPACE} * 2)) + +rootfs_image_sectors_overhead=$(awk -v r1="$actual_rootfs_size" "BEGIN{printf \"%.0f\", r1 * ${IMAGE_OVERHEAD_FACTOR}}") +if [ "${rootfs_image_sectors_overhead}" -gt "${rootfs_image_sectors}" ]; then + rootfs_image_sectors="${rootfs_image_sectors_overhead}" +fi if [ ${rootfs_image_sectors} -gt ${rootfs_part_sectors} ]; then log_warn "The calculated rootfs partition size $(disk_sectors_to_mb ${rootfs_part_sectors}) MiB is too small." log_warn "The actual rootfs image size is $(disk_sectors_to_mb ${rootfs_image_sectors}) MiB" - log_fatal "You can try adjusting the MENDER_STORAGE_TOTAL_SIZE_MB variable to increase available space" + log_fatal "You can try adjusting the MENDER_STORAGE_TOTAL_SIZE_MB variable to increase available space, or modify one of the variables IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_EXTRA_SPACE or IMAGE_OVERHEAD_FACTOR to reduce the size of the root filesystem." fi +log_info "Rootfs filesystem size will be $(disk_sectors_to_mb ${rootfs_image_sectors}) MiB" + # Extract file-system type from rootfs if file ${root_part} | grep -q ext4; then image_fs_type="ext4" @@ -180,9 +197,9 @@ log_info "Creating Mender compatible disk-image" sdimg_path=deploy/${image_name}.sdimg log_info "Total disk size: $(disk_sectors_to_mb ${disk_image_total_sectors}) MiB" -log_info " Boot partition $(disk_sectors_to_mb ${boot_part_sectors}) MiB" -log_info " RootFS $(disk_sectors_to_mb ${rootfs_part_sectors}) x 2 MiB" -log_info " Data $(disk_sectors_to_mb ${data_part_sectors}) MiB" +log_info " Boot partition $(disk_sectors_to_mb ${boot_part_sectors}) MiB" +log_info " RootFS partitions $(disk_sectors_to_mb ${rootfs_part_sectors}) MiB x 2" +log_info " Data partition $(disk_sectors_to_mb ${data_part_sectors}) MiB" # Initialize sdcard image file run_and_log_cmd \ @@ -234,10 +251,22 @@ if [ "${MENDER_USE_BMAP}" == "y" ]; then run_and_log_cmd "${BMAP_TOOL} create ${sdimg_path} > ${sdimg_path}.bmap" fi -if [ "${MENDER_COMPRESS_DISK_IMAGE}" == "y" ]; then - log_info "Compressing ${sdimg_path}.gz" - run_and_log_cmd "pigz --best --force ${sdimg_path}" -fi +case "${MENDER_COMPRESS_DISK_IMAGE}" in + gzip) + log_info "Compressing ${sdimg_path}.gz" + run_and_log_cmd "pigz --best --force ${sdimg_path}" + ;; + lzma) + log_info "Compressing ${sdimg_path}.xz" + run_and_log_cmd "pxz --best --force ${sdimg_path}" + ;; + none) + : + ;; + *) + log_fatal "Unknown MENDER_COMPRESS_DISK_IMAGE value: ${MENDER_COMPRESS_DISK_IMAGE}" + ;; +esac log_info "Conversion has completed! \o/" diff --git a/scripts/test/run-tests.sh b/scripts/test/run-tests.sh new file mode 100755 index 0000000..0f493f6 --- /dev/null +++ b/scripts/test/run-tests.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +set -e + +usage() { + echo "$0 <--all | --prebuilt-image DEVICE_TYPE IMAGE_NAME>" + exit 1 +} + +root_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd ) +if [ "${root_dir}" != "${PWD}" ]; then + echo "You must execute $(basename $0) from the root directory: ${root_dir}" + exit 1 +fi + +WORKSPACE=./tests + +BBB_DEBIAN_IMAGE="bone-debian-9.5-iot-armhf-2018-10-07-4gb.img" +BBB_DEBIAN_IMAGE_URL="http://debian.beagleboard.org/images/${BBB_DEBIAN_IMAGE}.xz" + +RASPBIAN_IMAGE="2019-09-26-raspbian-buster-lite" +RASPBIAN_IMAGE_URL="http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip" + +TINKER_IMAGE="20170417-tinker-board-linaro-stretch-alip-v1.8" +TINKER_IMAGE_URL="http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/${TINKER_IMAGE}.zip" + +UBUNTU_IMAGE="Ubuntu-Bionic-x86-64.img" +UBUNTU_IMAGE_URL="https://d1b0l86ne08fsf.cloudfront.net/mender-convert/images/${UBUNTU_IMAGE}.gz" + +UBUNTU_SERVER_RPI_IMAGE="ubuntu-18.04.3-preinstalled-server-armhf+raspi3.img" +UBUNTU_SERVER_RPI_IMAGE_URL="http://cdimage.ubuntu.com/ubuntu/releases/bionic/release/${UBUNTU_SERVER_RPI_IMAGE}.xz" + +# Keep common function declarations in separate utils script +UTILS_PATH=${0/$(basename $0)/test-utils.sh} +source $UTILS_PATH + +# Some distros do not have /sbin in path for "normal users" +export PATH="${PATH}:/sbin" + +if [ ! -d ${WORKSPACE}/mender-image-tests ]; then + git clone https://github.com/mendersoftware/mender-image-tests ${WORKSPACE}/mender-image-tests +else + cd ${WORKSPACE}/mender-image-tests + git pull + cd - +fi + +mkdir -p ${WORKSPACE} + +get_pytest_files + +test_result=0 + +case "$1" in + --prebuilt-image) + if [ -z "$3" ]; then + echo "Both DEVICE_TYPE and IMAGE_NAME must be specified" + exit 1 + fi + test_result=0 + run_tests "$2" "$3" || test_result=$? + exit $test_result + ;; + + --all) + convert_and_test "qemux86_64" \ + "release-1" \ + "${UBUNTU_IMAGE_URL}" \ + "${UBUNTU_IMAGE}" \ + "${UBUNTU_IMAGE}.gz" \ + "configs/qemux86-64_config" || test_result=$? + + convert_and_test "raspberrypi" \ + "release-1" \ + "${RASPBIAN_IMAGE_URL}" \ + "${RASPBIAN_IMAGE}.img" \ + "${RASPBIAN_IMAGE}.zip" \ + "configs/raspberrypi3_config" || test_result=$? + + # MEN-2809: Disabled due broken download link + #convert_and_test "linaro-alip" \ + # "release-1" \ + # "${TINKER_IMAGE_URL}" \ + # "${TINKER_IMAGE}.img" \ + # "${TINKER_IMAGE}.zip" || test_result=$? + + convert_and_test "beaglebone" \ + "release-1" \ + "${BBB_DEBIAN_IMAGE_URL}" \ + "${BBB_DEBIAN_IMAGE}" \ + "${BBB_DEBIAN_IMAGE}.xz" || test_result=$? + + convert_and_test "ubuntu" \ + "release-1" \ + "${UBUNTU_SERVER_RPI_IMAGE_URL}" \ + "${UBUNTU_SERVER_RPI_IMAGE}" \ + "${UBUNTU_SERVER_RPI_IMAGE}.xz" \ + "configs/raspberrypi3_config" || test_result=$? + + exit $test_result + ;; + + *) + usage + ;; +esac diff --git a/scripts/run-tests.sh b/scripts/test/test-utils.sh old mode 100755 new mode 100644 similarity index 52% rename from scripts/run-tests.sh rename to scripts/test/test-utils.sh index cdef884..f4f323d --- a/scripts/run-tests.sh +++ b/scripts/test/test-utils.sh @@ -1,37 +1,8 @@ -#!/bin/bash - -set -e - -root_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd ) -if [ "${root_dir}" != "${PWD}" ]; then - echo "You must execute $(basename $0) from the root directory: ${root_dir}" - exit 1 -fi - -WORKSPACE=./tests - -# Relative to where scripts are executed (${WORKSPACE}/mender-image-tests) -MENDER_CONVERT_DIR=../../ - -BBB_DEBIAN_IMAGE="bone-debian-9.5-iot-armhf-2018-10-07-4gb.img" -BBB_DEBIAN_IMAGE_URL="http://debian.beagleboard.org/images/${BBB_DEBIAN_IMAGE}.xz" - -RASPBIAN_IMAGE="2019-04-08-raspbian-stretch-lite" -RASPBIAN_IMAGE_URL="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-04-09/${RASPBIAN_IMAGE}.zip" - -TINKER_IMAGE="20170417-tinker-board-linaro-stretch-alip-v1.8" -TINKER_IMAGE_URL="http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/${TINKER_IMAGE}.zip" - -UBUNTU_IMAGE="Ubuntu-Bionic-x86-64.img" -UBUNTU_IMAGE_URL="https://d1b0l86ne08fsf.cloudfront.net/mender-convert/images/${UBUNTU_IMAGE}.gz" - -UBUNTU_SERVER_RPI_IMAGE="ubuntu-18.04.3-preinstalled-server-armhf+raspi3.img" -UBUNTU_SERVER_RPI_IMAGE_URL="http://cdimage.ubuntu.com/ubuntu/releases/bionic/release/${UBUNTU_SERVER_RPI_IMAGE}.xz" - MENDER_ACCEPTANCE_URL="https://raw.githubusercontent.com/mendersoftware/meta-mender/master/tests/acceptance" -# Some distros do not have /sbin in path for "normal users" -export PATH="${PATH}:/sbin" +WORKSPACE=${WORKSPACE:-./tests} + +MENDER_CONVERT_DIR=$PWD convert_and_test() { device_type=$1 @@ -72,12 +43,12 @@ convert_and_test() { # - test providing multiple '--config' options # # - (when no platform configuration is provided) test conversion without - # '--config' and with MENDER_COMPRESS_DISK_IMAGE=y. Compressed disk + # '--config' and with MENDER_COMPRESS_DISK_IMAGE=gzip. Compressed disk # images is the default user facing option and we need to ensure that we # cover this in the tests. if [ -n "${config}" ]; then echo "Will disable MENDER_COMPRESS_DISK_IMAGE for this image" - echo "MENDER_COMPRESS_DISK_IMAGE=n" > ${WORKSPACE}/test_config + echo "MENDER_COMPRESS_DISK_IMAGE=none" > ${WORKSPACE}/test_config local MENDER_CONVERT_EXTRA_ARGS="--config ${config} --config ${WORKSPACE}/test_config" fi @@ -85,11 +56,25 @@ convert_and_test() { --disk-image input/${image_name} \ ${MENDER_CONVERT_EXTRA_ARGS} + local ret=0 + run_tests "${device_type}" "${artifact_name}" || ret=$? + + rm -f deploy/${device_type}-${artifact_name}.* + + return $ret +} + +run_tests() { + device_type=$1 + artifact_name=$2 + shift 2 + pytest_args_extra=$@ + if pip3 list | grep -q -e pytest-html; then 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=y before + # Need to decompress images built with MENDER_COMPRESS_DISK_IMAGE=gzip before # running tests. if [ -f deploy/${device_type}-${artifact_name}.sdimg.gz ]; then # sudo is needed because the image is created using docker-mender-convert @@ -101,7 +86,7 @@ convert_and_test() { # This is a trick to make pytest generate different junit reports # for different runs: renaming the tests folder to tests_ - cp -r tests tests_${device_type} + cp -r tests tests_${device_type}_${artifact_name} python3 -m pytest --verbose \ --junit-xml="${MENDER_CONVERT_DIR}/results_${device_type}.xml" \ @@ -111,7 +96,8 @@ convert_and_test() { --board-type="${device_type}" \ --mender-image=${device_type}-${artifact_name}.sdimg \ --sdimg-location="${MENDER_CONVERT_DIR}/deploy" \ - tests_${device_type} + tests_${device_type}_${artifact_name} \ + ${pytest_args_extra} exitcode=$? cd - @@ -126,52 +112,3 @@ get_pytest_files() { wget -N ${MENDER_ACCEPTANCE_URL}/fixtures.py -P $WORKSPACE/mender-image-tests } -if [ ! -d ${WORKSPACE}/mender-image-tests ]; then - git clone https://github.com/mendersoftware/mender-image-tests ${WORKSPACE}/mender-image-tests -else - cd ${WORKSPACE}/mender-image-tests - git pull - cd - -fi - -mkdir -p ${WORKSPACE} - -get_pytest_files - -test_result=0 - -convert_and_test "qemux86_64" \ - "release-1" \ - "${UBUNTU_IMAGE_URL}" \ - "${UBUNTU_IMAGE}" \ - "${UBUNTU_IMAGE}.gz" \ - "configs/qemux86-64_config" || test_result=$? - -convert_and_test "raspberrypi" \ - "release-1" \ - "${RASPBIAN_IMAGE_URL}" \ - "${RASPBIAN_IMAGE}.img" \ - "${RASPBIAN_IMAGE}.zip" \ - "configs/raspberrypi3_config" || test_result=$? - -# MEN-2809: Disabled due broken download link -#convert_and_test "linaro-alip" \ -# "release-1" \ -# "${TINKER_IMAGE_URL}" \ -# "${TINKER_IMAGE}.img" \ -# "${TINKER_IMAGE}.zip" || test_result=$? - -convert_and_test "beaglebone" \ - "release-1" \ - "${BBB_DEBIAN_IMAGE_URL}" \ - "${BBB_DEBIAN_IMAGE}" \ - "${BBB_DEBIAN_IMAGE}.xz" || test_result=$? - -convert_and_test "ubuntu" \ - "release-1" \ - "${UBUNTU_SERVER_RPI_IMAGE_URL}" \ - "${UBUNTU_SERVER_RPI_IMAGE}" \ - "${UBUNTU_SERVER_RPI_IMAGE}.xz" \ - "configs/raspberrypi3_config" || test_result=$? - -exit $test_result