Browse Source

Switch run-test to accept --prebuilt-image parameters.

This avoid problems when running the tests locally. Technically it
will run the Raspberry Pi test twice on Gitlab, once with the prebuilt
image, and once with a test image, but the two configurations are not
identical, so I reckon that's alright.

Changelog: None

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
2.0.x
Kristian Amlie 5 years ago
parent
commit
3cb78bf17c
No known key found for this signature in database GPG Key ID: F464407C996AF03F
  1. 9
      .gitlab-ci.yml
  2. 96
      scripts/test/run-tests.sh

9
.gitlab-ci.yml

@ -61,9 +61,10 @@ test_acceptance:
- 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-mender-raspbian.sdimg.xz
- unxz deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.sdimg.xz
script:
- ./scripts/test/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
@ -93,7 +94,7 @@ convert_raspbian:
script:
- echo "MENDER_CLIENT_VERSION=${MENDER_CLIENT_VERSION}" > mender_client_version_config
- env MENDER_ARTIFACT_NAME=mender-raspbian
- 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
@ -116,7 +117,7 @@ publish:s3:
script:
- echo "Publishing ${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.img.xz version to S3"
- aws s3 cp deploy/raspberrypi-mender-raspbian.sdimg.xz
- 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

96
scripts/test/run-tests.sh

@ -2,6 +2,11 @@
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}"
@ -13,6 +18,9 @@ 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"
@ -43,38 +51,56 @@ 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=$?
if [ -f deploy/raspberrypi-mender-raspbian.sdimg ]; then
run_tests "raspberrypi" "mender-raspbian" || test_result=$?
else
echo "FAILED! This test needs a pre-converted Raspbian image. See the convert_raspbian job in the .gitlab-ci.yml file for how to generate, and then put the *uncompressed* image in the deploy folder"
test_result=1
fi
# 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
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

Loading…
Cancel
Save