Browse Source

Merge pull request #470 from kacf/no_grub.d

test: Add a configuration with MENDER_GRUB_D_INTEGRATION turned off.
create-pull-request/patch
Kristian Amlie 2 years ago
committed by GitHub
parent
commit
78afc04a47
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      .gitlab-ci.yml
  2. 1
      configs/testing/no-grub.d_config
  3. 7
      mender-convert-package
  4. 6
      scripts/test/mender-convert-qemu
  5. 21
      scripts/test/run-tests.sh
  6. 2
      tests/mender-image-tests
  7. 7
      tests/test_grub_integration.py

13
.gitlab-ci.yml

@ -251,13 +251,20 @@ test_acceptance_prebuilt_raspberrypi4:
variables:
RASPBERRYPI_PLATFORM: raspberrypi4
test_acceptance_qemux86_64:
test_acceptance_ubuntu_qemux86_64:
<<: *test_acceptance
script:
- mkdir -p input/config
- cp versions_override_config input/config/versions_override_config
- ./scripts/test/run-tests.sh --config input/config/versions_override_config --only ubuntu-qemux86-64
test_acceptance_ubuntu_qemux86_64_no_grub_d:
<<: *test_acceptance
script:
- mkdir -p input/config
- cp versions_override_config input/config/versions_override_config
- ./scripts/test/run-tests.sh --config input/config/versions_override_config --only ubuntu-qemux86-64-no-grub-d
test_acceptance_debian_qemux86_64:
<<: *test_acceptance
script:
@ -279,12 +286,12 @@ test_acceptance_beaglebone:
- cp versions_override_config input/config/versions_override_config
- ./scripts/test/run-tests.sh --config input/config/versions_override_config --only beaglebone
test_acceptance_ubuntu:
test_acceptance_ubuntu_raspberrypi3:
<<: *test_acceptance
script:
- mkdir -p input/config
- cp versions_override_config input/config/versions_override_config
- ./scripts/test/run-tests.sh --config input/config/versions_override_config --only ubuntu
- ./scripts/test/run-tests.sh --config input/config/versions_override_config --only ubuntu-raspberrypi3
.template:publish:s3:
stage: publish

1
configs/testing/no-grub.d_config

@ -0,0 +1 @@
MENDER_GRUB_D_INTEGRATION=n

7
mender-convert-package

@ -388,6 +388,7 @@ testscfg_add "MENDER_ARTIFACT_NAME" "${MENDER_ARTIFACT_NAME}"
testscfg_add "MENDER_FEATURES" "${mender_features}"
testscfg_add "DEPLOY_DIR_IMAGE" "${PWD}/deploy"
testscfg_add "MENDER_MACHINE" "${device_type}"
testscfg_add "MENDER_GRUB_D_INTEGRATION" "${MENDER_GRUB_D_INTEGRATION}"
# Outputting device base only relevant for some configurations
if [ "${MENDER_ENABLE_PARTUUID}" != "y" ]; then
@ -395,7 +396,11 @@ if [ "${MENDER_ENABLE_PARTUUID}" != "y" ]; then
fi
# Something that the tests expect to be defined (originally from Yocto)
testscfg_add "IMAGE_FSTYPES" "${image_fs_type} mender sdimg"
if [ "$MENDER_GRUB_EFI_INTEGRATION" = "y" ]; then
testscfg_add "IMAGE_FSTYPES" "${image_fs_type} mender uefiimg"
else
testscfg_add "IMAGE_FSTYPES" "${image_fs_type} mender sdimg"
fi
testscfg_add "ARTIFACTIMG_FSTYPE" "${image_fs_type}"
# Save configuration file for tests

6
scripts/test/mender-convert-qemu

@ -27,6 +27,10 @@ if [ -z "${ovmf_file}" ]; then
exit 1
fi
if [ "$QEMU_NO_SECURE_BOOT" != "1" ]; then
OVMF_VARS="-drive file=$(dirname "$0")/../../tests/uefi-nvram/OVMF_VARS.fd,if=pflash,format=raw,unit=1,readonly=on"
fi
qemu-system-x86_64 \
-enable-kvm \
-nographic \
@ -34,7 +38,7 @@ qemu-system-x86_64 \
-net user,hostfwd=tcp::8822-:22 \
-net nic,macaddr=52:54:00$(od -txC -An -N3 /dev/urandom|tr \ :) \
-drive file=${ovmf_file},if=pflash,format=raw,unit=0,readonly=on \
-drive file="$(dirname "$0")/../../tests/uefi-nvram/OVMF_VARS.fd",if=pflash,format=raw,unit=1,readonly=on \
$OVMF_VARS \
-drive format=raw,file=${DISK_IMG} &
qemu_pid=$!

21
scripts/test/run-tests.sh

@ -102,7 +102,7 @@ else
if [ "$TEST_ALL" == "1" -o "$TEST_PLATFORM" == "ubuntu-qemux86-64" ]; then
wget --progress=dot:giga -N ${UBUNTU_IMAGE_URL} -P input/image/
mkdir -p input/tests
cp -r "tests/ssh-public-key-overlay" "input/tests/ssh-public-key-overlay"
sudo cp -r "tests/ssh-public-key-overlay" "input/tests/"
convert_and_test "qemux86-64" \
"release-1" \
"input/image/Ubuntu-Focal-x86-64.img.gz" \
@ -123,6 +123,21 @@ else
assert "${ret}" "0" "Expected uncompressed file deploy/Ubuntu-Focal-x86-64-qemux86-64-mender.img"
fi
if [ "$TEST_ALL" == "1" -o "$TEST_PLATFORM" == "ubuntu-qemux86-64-no-grub-d" ]; then
wget --progress=dot:giga -N ${UBUNTU_IMAGE_URL} -P input/image/
mkdir -p input/tests
sudo cp -r "tests/ssh-public-key-overlay" "input/tests/"
QEMU_NO_SECURE_BOOT=1 \
convert_and_test \
"qemux86-64" \
"release-1" \
"input/image/Ubuntu-Focal-x86-64.img.gz" \
"--overlay input/tests/ssh-public-key-overlay" \
"--config configs/ubuntu-qemux86-64_config" \
"--config configs/testing/no-grub.d_config $EXTRA_CONFIG" \
|| test_result=$?
fi
if [ "$TEST_ALL" == "1" -o "$TEST_PLATFORM" == "raspberrypi3" ]; then
wget --progress=dot:giga -N ${RASPBIAN_IMAGE_URL} -P input/image/
RASPBIAN_IMAGE="${RASPBIAN_IMAGE_URL##*/}"
@ -157,7 +172,7 @@ else
|| test_result=$?
fi
if [ "$TEST_ALL" == "1" -o "$TEST_PLATFORM" == "ubuntu" ]; then
if [ "$TEST_ALL" == "1" -o "$TEST_PLATFORM" == "ubuntu-raspberrypi3" ]; then
wget --progress=dot:giga -N ${UBUNTU_SERVER_RPI_IMAGE_URL} -P input/image/
UBUNTU_SERVER_RPI_IMAGE_COMPRESSED="${UBUNTU_SERVER_RPI_IMAGE_URL##*/}"
convert_and_test "raspberrypi3" \
@ -170,7 +185,7 @@ else
if [ "$TEST_ALL" == "1" -o "$TEST_PLATFORM" == "debian-qemux86-64" ]; then
wget --progress=dot:giga -N ${DEBIAN_IMAGE_URL} -P input/image/
mkdir -p input/tests
cp -r "tests/ssh-public-key-overlay" "input/tests/ssh-public-key-overlay"
sudo cp -r "tests/ssh-public-key-overlay" "input/tests/"
convert_and_test "qemux86-64" \
"release-1" \
"input/image/Debian-11-x86-64.img.gz" \

2
tests/mender-image-tests

@ -1 +1 @@
Subproject commit 43385d2db58224a12e36d1cd63c3b6057f4e6809
Subproject commit 0513c601b27599f13692295c50e87ee28425b310

7
tests/test_grub_integration.py

@ -76,8 +76,13 @@ def check_all_root_occurrences_valid(grub_cfg):
assert found_expected, "Expected content (%s) not found" % expected
@pytest.fixture(scope="session")
def only_grub_d_integration(bitbake_variables):
if bitbake_variables["MENDER_GRUB_D_INTEGRATION"] == "n":
pytest.skip("grub.d integration is off, skipping test")
@pytest.mark.usefixtures("setup_board", "cleanup_boot_scripts")
@pytest.mark.usefixtures("setup_board", "cleanup_boot_scripts", "only_grub_d_integration")
class TestGrubIntegration:
@pytest.mark.min_mender_version("1.0.0")
def test_no_root_occurrences(self, connection, latest_part_image):

Loading…
Cancel
Save