Browse Source

Merge pull request #281 from lluiscampos/tests-fixes

Dependabot + New Year + Test fixes
2.3.x
Lluis Campos 4 years ago
committed by GitHub
parent
commit
626bea4a6e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      LICENSE
  2. 3
      LIC_FILES_CHKSUM.sha256
  3. 5
      mender-convert
  4. 6
      mender-convert-modify
  5. 51
      mender-convert-package
  6. 47
      modules/testscfg.sh
  7. 2
      tests/mender-image-tests

2
LICENSE

@ -1,4 +1,4 @@
Copyright 2020 Northern.tech AS
Copyright 2021 Northern.tech AS
All content in this project is licensed under the Apache License v2, unless
indicated otherwise.

3
LIC_FILES_CHKSUM.sha256

@ -1,2 +1 @@
32714818ad6f98ee0185a52e23a475d89122e3efd2b2c26c733781c28e798c99 LICENSE
b4acfcfa2a0ba1a8c82ec3965fbcee886cff8394ca4214e0ddac0a36beb1e05a LICENSE

5
mender-convert

@ -1,6 +1,6 @@
#! /usr/bin/env bash
#
# Copyright 2019 Northern.tech AS
# Copyright 2021 Northern.tech AS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
source modules/bootstrap.sh
source modules/cliparser.sh
source modules/decompressinput.sh
source modules/testscfg.sh
export MENDER_CONVERT_LOG_FILE=$(pwd)/${MENDER_CONVERT_LOG_FILE:-logs/convert.log}
touch ${MENDER_CONVERT_LOG_FILE}
@ -118,6 +119,8 @@ if [ -z "${MENDER_ARTIFACT_NAME}" ]; then
exit 1
fi
testscfg_init
parse_cli_options "$@"
compression_type=$(compression_type "${disk_image}")

6
mender-convert-modify

@ -1,6 +1,6 @@
#! /usr/bin/env bash
#
# Copyright 2020 Northern.tech AS
# Copyright 2021 Northern.tech AS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -50,6 +50,7 @@ source modules/bootstrap.sh
source modules/disk.sh
source modules/probe.sh
source modules/deb.sh
source modules/testscfg.sh
# The mender_convert_config is always used and provides all the defaults
declare -a configs=("configs/mender_convert_config")
@ -113,6 +114,9 @@ fi
deb_extract_package "work/deb-packages/${deb_name}" "work/rootfs/"
# Save installed client version for tests in Yocto variable format
testscfg_add "PREFERRED_VERSION_mender-client" "$(echo ${deb_name} | sed -r 's/.*_([0-9]+\.[0-9]+\.[0-9]+).*/\1/')"
if [ "${MENDER_ENABLE_SYSTEMD}" == "y" ]; then
run_and_log_cmd "sudo ln -sf /lib/systemd/system/mender-client.service \
work/rootfs/etc/systemd/system/multi-user.target.wants/mender-client.service"

51
mender-convert-package

@ -1,6 +1,6 @@
#! /usr/bin/env bash
#
# Copyright 2020 Northern.tech AS
# Copyright 2021 Northern.tech AS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -38,6 +38,7 @@ echo "Running $(basename $0): $@"
source modules/bootstrap.sh
source modules/disk.sh
source modules/testscfg.sh
# The mender_convert_config is always used and provides all the defaults
declare -a configs=("configs/mender_convert_config")
@ -350,35 +351,31 @@ else
fi
mender_features="${bootloader_feature} mender-convert"
cat <<- EOF > deploy/${image_name}.cfg
MENDER_BOOT_PART="${boot_part_device}"
MENDER_ROOTFS_PART_A="${root_part_a_device}"
MENDER_ROOTFS_PART_B="${root_part_b_device}"
MENDER_DATA_PART="${data_part_device}"
MENDER_BOOT_PART_MOUNT_LOCATION="${boot_part_mountpoint}"
MENDER_BOOT_PART_SIZE_MB="$(disk_sectors_to_mb ${boot_part_sectors})"
MENDER_DATA_PART_SIZE_MB="${MENDER_DATA_PART_SIZE_MB}"
MENDER_DEVICE_TYPE="${device_type}"
MENDER_PARTITIONING_OVERHEAD_KB="$(( (${overhead_sectors} * 512) / 1024 ))"
MENDER_PARTITION_ALIGNMENT="${MENDER_PARTITION_ALIGNMENT}"
MENDER_STORAGE_TOTAL_SIZE_MB="${MENDER_STORAGE_TOTAL_SIZE_MB}"
MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET="12582912"
MENDER_ARTIFACT_NAME="${artifact_name}"
MENDER_FEATURES="${mender_features}"
DEPLOY_DIR_IMAGE="${PWD}/deploy"
MENDER_MACHINE="${device_type}"
EOF
testscfg_add "MENDER_BOOT_PART" "${boot_part_device}"
testscfg_add "MENDER_ROOTFS_PART_A" "${root_part_a_device}"
testscfg_add "MENDER_ROOTFS_PART_B" "${root_part_b_device}"
testscfg_add "MENDER_DATA_PART" "${data_part_device}"
testscfg_add "MENDER_BOOT_PART_MOUNT_LOCATION" "${boot_part_mountpoint}"
testscfg_add "MENDER_BOOT_PART_SIZE_MB" "$(disk_sectors_to_mb ${boot_part_sectors})"
testscfg_add "MENDER_DATA_PART_SIZE_MB" "${MENDER_DATA_PART_SIZE_MB}"
testscfg_add "MENDER_DEVICE_TYPE" "${device_type}"
testscfg_add "MENDER_PARTITIONING_OVERHEAD_KB" "$(( (${overhead_sectors} * 512) / 1024 ))"
testscfg_add "MENDER_PARTITION_ALIGNMENT" "${MENDER_PARTITION_ALIGNMENT}"
testscfg_add "MENDER_STORAGE_TOTAL_SIZE_MB" "${MENDER_STORAGE_TOTAL_SIZE_MB}"
testscfg_add "MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET" "12582912"
testscfg_add "MENDER_ARTIFACT_NAME" "${artifact_name}"
testscfg_add "MENDER_FEATURES" "${mender_features}"
testscfg_add "DEPLOY_DIR_IMAGE" "${PWD}/deploy"
testscfg_add "MENDER_MACHINE" "${device_type}"
# Outputting device base only relevant for some configurations
if [ "${MENDER_ENABLE_PARTUUID}" != "y" ]; then
cat <<- EOF >> deploy/${image_name}.cfg
MENDER_STORAGE_DEVICE_BASE="${MENDER_STORAGE_DEVICE_BASE}"
EOF
testscfg_add "MENDER_STORAGE_DEVICE_BASE" "${MENDER_STORAGE_DEVICE_BASE}"
fi
# Something that the tests expect to be defined (originally from Yocto)
cat <<- EOF >> deploy/${image_name}.cfg
IMAGE_FSTYPES="${image_fs_type} mender sdimg"
ARTIFACTIMG_FSTYPE="${image_fs_type}"
EOF
testscfg_add "IMAGE_FSTYPES" "${image_fs_type} mender sdimg"
testscfg_add "ARTIFACTIMG_FSTYPE" "${image_fs_type}"
# Save configuration file for tests
testscfg_save deploy/${image_name}.cfg

47
modules/testscfg.sh

@ -0,0 +1,47 @@
#
# Copyright 2021 Northern.tech AS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Init tests configuration file
#
function testscfg_init () {
rm -f work/testscfg.tmp
touch work/testscfg.tmp
}
# Add key/value to tests configuration file
#
# $1 - key
# $2 - value
#
function testscfg_add () {
if [[ $# -ne 2 ]]; then
log_fatal "testscfg_add() requires 2 arguments"
fi
local -r key="${1}"
local -r value="${2}"
echo "${key}=\"${value}\"" >> work/testscfg.tmp
}
# Save tests configuration file into the given location
#
# $1 - Filename
#
function testscfg_save () {
if [[ $# -ne 1 ]]; then
log_fatal "testscfg_save() requires 1 argument"
fi
local -r filename="${1}"
cp work/testscfg.tmp ${filename}
}

2
tests/mender-image-tests

@ -1 +1 @@
Subproject commit 5f8885448d946ee2fed099aa541e5f8c277b20c9
Subproject commit 55c846d681c21045a8fa839c40dff0f07c2cc512
Loading…
Cancel
Save