|
@ -4,8 +4,8 @@ set -e |
|
|
|
|
|
|
|
|
root_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd ) |
|
|
root_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd ) |
|
|
if [ "${root_dir}" != "${PWD}" ]; then |
|
|
if [ "${root_dir}" != "${PWD}" ]; then |
|
|
echo "You must execute $(basename $0) from the root directory: ${root_dir}" |
|
|
echo "You must execute $(basename $0) from the root directory: ${root_dir}" |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
WORKSPACE=./tests |
|
|
WORKSPACE=./tests |
|
@ -34,104 +34,104 @@ MENDER_ACCEPTANCE_URL="https://raw.githubusercontent.com/mendersoftware/meta-men |
|
|
export PATH="${PATH}:/sbin" |
|
|
export PATH="${PATH}:/sbin" |
|
|
|
|
|
|
|
|
convert_and_test() { |
|
|
convert_and_test() { |
|
|
device_type=$1 |
|
|
device_type=$1 |
|
|
artifact_name=$2 |
|
|
artifact_name=$2 |
|
|
image_url=$3 |
|
|
image_url=$3 |
|
|
image_name=$4 |
|
|
image_name=$4 |
|
|
image_name_compressed=$5 |
|
|
image_name_compressed=$5 |
|
|
config=$6 # Optional |
|
|
config=$6 # Optional |
|
|
|
|
|
|
|
|
wget --progress=dot:giga -N ${image_url} -P input/ |
|
|
wget --progress=dot:giga -N ${image_url} -P input/ |
|
|
|
|
|
|
|
|
echo "Extracting: ${image_name_compressed}" |
|
|
echo "Extracting: ${image_name_compressed}" |
|
|
case "${image_name_compressed}" in |
|
|
case "${image_name_compressed}" in |
|
|
*.gz) |
|
|
*.gz) |
|
|
gunzip -f input/${image_name_compressed} |
|
|
gunzip -f input/${image_name_compressed} |
|
|
;; |
|
|
;; |
|
|
*.zip) |
|
|
*.zip) |
|
|
cd input |
|
|
cd input |
|
|
unzip -o ${image_name_compressed} |
|
|
unzip -o ${image_name_compressed} |
|
|
cd - |
|
|
cd - |
|
|
;; |
|
|
;; |
|
|
*.xz) |
|
|
*.xz) |
|
|
xz -d -f input/${image_name_compressed} |
|
|
xz -d -f input/${image_name_compressed} |
|
|
;; |
|
|
;; |
|
|
*) |
|
|
*) |
|
|
echo "Unknown image type: ${image_name_compressed}" |
|
|
echo "Unknown image type: ${image_name_compressed}" |
|
|
exit 1 |
|
|
exit 1 |
|
|
esac |
|
|
;; |
|
|
|
|
|
esac |
|
|
rm -f ${WORKSPACE}/test_config |
|
|
|
|
|
|
|
|
rm -f ${WORKSPACE}/test_config |
|
|
|
|
|
|
|
|
# Two motives for the following statement |
|
|
# Two motives for the following statement |
|
|
# |
|
|
# |
|
|
# - speed up tests by avoiding decompression on all images (majority of images |
|
|
# - speed up tests by avoiding decompression on all images (majority of images |
|
|
# we test have a platform specific configuration) |
|
|
# we test have a platform specific configuration) |
|
|
# |
|
|
# |
|
|
# - test providing multiple '--config' options |
|
|
# - test providing multiple '--config' options |
|
|
# |
|
|
# |
|
|
# - (when no platform configuration is provided) test conversion without |
|
|
# - (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=y. Compressed disk |
|
|
# images is the default user facing option and we need to ensure that we |
|
|
# images is the default user facing option and we need to ensure that we |
|
|
# cover this in the tests. |
|
|
# cover this in the tests. |
|
|
if [ -n "${config}" ]; then |
|
|
if [ -n "${config}" ]; then |
|
|
echo "Will disable MENDER_COMPRESS_DISK_IMAGE for this image" |
|
|
echo "Will disable MENDER_COMPRESS_DISK_IMAGE for this image" |
|
|
echo "MENDER_COMPRESS_DISK_IMAGE=n" > ${WORKSPACE}/test_config |
|
|
echo "MENDER_COMPRESS_DISK_IMAGE=n" > ${WORKSPACE}/test_config |
|
|
local MENDER_CONVERT_EXTRA_ARGS="--config ${config} --config ${WORKSPACE}/test_config" |
|
|
local MENDER_CONVERT_EXTRA_ARGS="--config ${config} --config ${WORKSPACE}/test_config" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
MENDER_ARTIFACT_NAME=${artifact_name} ./docker-mender-convert \ |
|
|
MENDER_ARTIFACT_NAME=${artifact_name} ./docker-mender-convert \ |
|
|
--disk-image input/${image_name} \ |
|
|
--disk-image input/${image_name} \ |
|
|
${MENDER_CONVERT_EXTRA_ARGS} |
|
|
${MENDER_CONVERT_EXTRA_ARGS} |
|
|
|
|
|
|
|
|
if pip3 list | grep -q -e pytest-html; then |
|
|
if pip3 list | grep -q -e pytest-html; then |
|
|
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=y before |
|
|
# Need to decompress images built with MENDER_COMPRESS_DISK_IMAGE=y before |
|
|
# running tests. |
|
|
# running tests. |
|
|
if [ -f deploy/${device_type}-${artifact_name}.sdimg.gz ]; then |
|
|
if [ -f deploy/${device_type}-${artifact_name}.sdimg.gz ]; then |
|
|
# sudo is needed because the image is created using docker-mender-convert |
|
|
# sudo is needed because the image is created using docker-mender-convert |
|
|
# which sets root permissions on the image |
|
|
# which sets root permissions on the image |
|
|
sudo gunzip --force deploy/${device_type}-${artifact_name}.sdimg.gz |
|
|
sudo gunzip --force deploy/${device_type}-${artifact_name}.sdimg.gz |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
cd ${WORKSPACE}/mender-image-tests |
|
|
cd ${WORKSPACE}/mender-image-tests |
|
|
|
|
|
|
|
|
# This is a trick to make pytest generate different junit reports |
|
|
# This is a trick to make pytest generate different junit reports |
|
|
# for different runs: renaming the tests folder to tests_<testsuite> |
|
|
# for different runs: renaming the tests folder to tests_<testsuite> |
|
|
cp -r tests tests_${device_type} |
|
|
cp -r tests tests_${device_type} |
|
|
|
|
|
|
|
|
python3 -m pytest --verbose \ |
|
|
python3 -m pytest --verbose \ |
|
|
--junit-xml="${MENDER_CONVERT_DIR}/results_${device_type}.xml" \ |
|
|
--junit-xml="${MENDER_CONVERT_DIR}/results_${device_type}.xml" \ |
|
|
${html_report_args} \ |
|
|
${html_report_args} \ |
|
|
--test-conversion \ |
|
|
--test-conversion \ |
|
|
--test-variables="${MENDER_CONVERT_DIR}/deploy/${device_type}-${artifact_name}.cfg" \ |
|
|
--test-variables="${MENDER_CONVERT_DIR}/deploy/${device_type}-${artifact_name}.cfg" \ |
|
|
--board-type="${device_type}" \ |
|
|
--board-type="${device_type}" \ |
|
|
--mender-image=${device_type}-${artifact_name}.sdimg \ |
|
|
--mender-image=${device_type}-${artifact_name}.sdimg \ |
|
|
--sdimg-location="${MENDER_CONVERT_DIR}/deploy" \ |
|
|
--sdimg-location="${MENDER_CONVERT_DIR}/deploy" \ |
|
|
tests_${device_type} |
|
|
tests_${device_type} |
|
|
exitcode=$? |
|
|
exitcode=$? |
|
|
|
|
|
|
|
|
cd - |
|
|
cd - |
|
|
|
|
|
|
|
|
return $exitcode |
|
|
return $exitcode |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
get_pytest_files() { |
|
|
get_pytest_files() { |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/pytest.ini -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/pytest.ini -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/common.py -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/common.py -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/conftest.py -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/conftest.py -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/fixtures.py -P $WORKSPACE/mender-image-tests |
|
|
wget -N ${MENDER_ACCEPTANCE_URL}/fixtures.py -P $WORKSPACE/mender-image-tests |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if [ ! -d ${WORKSPACE}/mender-image-tests ]; then |
|
|
if [ ! -d ${WORKSPACE}/mender-image-tests ]; then |
|
|
git clone https://github.com/mendersoftware/mender-image-tests ${WORKSPACE}/mender-image-tests |
|
|
git clone https://github.com/mendersoftware/mender-image-tests ${WORKSPACE}/mender-image-tests |
|
|
else |
|
|
else |
|
|
cd ${WORKSPACE}/mender-image-tests |
|
|
cd ${WORKSPACE}/mender-image-tests |
|
|
git pull |
|
|
git pull |
|
|
cd - |
|
|
cd - |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
mkdir -p ${WORKSPACE} |
|
|
mkdir -p ${WORKSPACE} |
|
@ -141,18 +141,18 @@ get_pytest_files |
|
|
test_result=0 |
|
|
test_result=0 |
|
|
|
|
|
|
|
|
convert_and_test "qemux86_64" \ |
|
|
convert_and_test "qemux86_64" \ |
|
|
"release-1" \ |
|
|
"release-1" \ |
|
|
"${UBUNTU_IMAGE_URL}" \ |
|
|
"${UBUNTU_IMAGE_URL}" \ |
|
|
"${UBUNTU_IMAGE}" \ |
|
|
"${UBUNTU_IMAGE}" \ |
|
|
"${UBUNTU_IMAGE}.gz" \ |
|
|
"${UBUNTU_IMAGE}.gz" \ |
|
|
"configs/qemux86-64_config" || test_result=$? |
|
|
"configs/qemux86-64_config" || test_result=$? |
|
|
|
|
|
|
|
|
convert_and_test "raspberrypi" \ |
|
|
convert_and_test "raspberrypi" \ |
|
|
"release-1" \ |
|
|
"release-1" \ |
|
|
"${RASPBIAN_IMAGE_URL}" \ |
|
|
"${RASPBIAN_IMAGE_URL}" \ |
|
|
"${RASPBIAN_IMAGE}.img" \ |
|
|
"${RASPBIAN_IMAGE}.img" \ |
|
|
"${RASPBIAN_IMAGE}.zip" \ |
|
|
"${RASPBIAN_IMAGE}.zip" \ |
|
|
"configs/raspberrypi3_config" || test_result=$? |
|
|
"configs/raspberrypi3_config" || test_result=$? |
|
|
|
|
|
|
|
|
# MEN-2809: Disabled due broken download link |
|
|
# MEN-2809: Disabled due broken download link |
|
|
#convert_and_test "linaro-alip" \ |
|
|
#convert_and_test "linaro-alip" \ |
|
@ -162,16 +162,16 @@ convert_and_test "raspberrypi" \ |
|
|
# "${TINKER_IMAGE}.zip" || test_result=$? |
|
|
# "${TINKER_IMAGE}.zip" || test_result=$? |
|
|
|
|
|
|
|
|
convert_and_test "beaglebone" \ |
|
|
convert_and_test "beaglebone" \ |
|
|
"release-1" \ |
|
|
"release-1" \ |
|
|
"${BBB_DEBIAN_IMAGE_URL}" \ |
|
|
"${BBB_DEBIAN_IMAGE_URL}" \ |
|
|
"${BBB_DEBIAN_IMAGE}" \ |
|
|
"${BBB_DEBIAN_IMAGE}" \ |
|
|
"${BBB_DEBIAN_IMAGE}.xz" || test_result=$? |
|
|
"${BBB_DEBIAN_IMAGE}.xz" || test_result=$? |
|
|
|
|
|
|
|
|
convert_and_test "ubuntu" \ |
|
|
convert_and_test "ubuntu" \ |
|
|
"release-1" \ |
|
|
"release-1" \ |
|
|
"${UBUNTU_SERVER_RPI_IMAGE_URL}" \ |
|
|
"${UBUNTU_SERVER_RPI_IMAGE_URL}" \ |
|
|
"${UBUNTU_SERVER_RPI_IMAGE}" \ |
|
|
"${UBUNTU_SERVER_RPI_IMAGE}" \ |
|
|
"${UBUNTU_SERVER_RPI_IMAGE}.xz" \ |
|
|
"${UBUNTU_SERVER_RPI_IMAGE}.xz" \ |
|
|
"configs/raspberrypi3_config" || test_result=$? |
|
|
"configs/raspberrypi3_config" || test_result=$? |
|
|
|
|
|
|
|
|
exit $test_result |
|
|
exit $test_result |
|
|