Browse Source

scripts: run-tests: increase coverage

With these changes we will additionally cover test with:

- MENDER_COMPRESS_DISK_IMAGE set to 'y' and 'n'
- multiple --config files
- no external configuration files (no '--config' options)

Changelog: None

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
2.0.x
Mirza Krak 5 years ago
parent
commit
ee58c51596
  1. 33
      scripts/run-tests.sh

33
scripts/run-tests.sh

@ -60,25 +60,40 @@ convert_and_test() {
rm -f ${WORKSPACE}/test_config rm -f ${WORKSPACE}/test_config
# Two motives for the following statement
#
# - speed up tests by avoiding decompression on all images (majority of images
# we test have a platform specific configuration)
#
# - test providing multiple '--config' options
#
# - (when no platform configuration is provided) test conversion without
# '--config' and with MENDER_COMPRESS_DISK_IMAGE=y. 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 if [ -n "${config}" ]; then
cp ${config} ${WORKSPACE}/test_config echo "Will disable MENDER_COMPRESS_DISK_IMAGE for this image"
echo "MENDER_COMPRESS_DISK_IMAGE=n" > ${WORKSPACE}/test_config
local MENDER_CONVERT_EXTRA_ARGS="--config ${config} --config ${WORKSPACE}/test_config"
fi fi
# Disable compression of disk image when testing, otherwise we need to
# unpack each image we test which is time consuming
echo "MENDER_COMPRESS_DISK_IMAGE=n" >> ${WORKSPACE}/test_config
echo "Configuration used:"
cat ${WORKSPACE}/test_config
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} \
--config ${WORKSPACE}/test_config ${MENDER_CONVERT_EXTRA_ARGS}
if pip list | grep -q -e pytest-html; then if pip 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
# running tests.
if [ -f deploy/${device_type}-${artifact_name}.sdimg.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/${device_type}-${artifact_name}.sdimg.gz
fi
cd ${WORKSPACE}/mender-image-tests cd ${WORKSPACE}/mender-image-tests
python2 -m pytest --verbose \ python2 -m pytest --verbose \

Loading…
Cancel
Save