From: Michael Opdenacker <michael.opdenac...@bootlin.com> Proof of concept "testimage" test to check whether the generated package feeds can be used to update an older image provided by the Yocto Project autobuilder.
Signed-off-by: Michael Opdenacker <michael.opdenac...@bootlin.com> Suggested-by: Richard Purdie <richard.pur...@linuxfoundation.org> CC: Thomas Petazzoni <thomas.petazz...@bootlin.com> CC: Bruce Ashfield <bruce.ashfi...@gmail.com> --- Tested on the latest master against yocto-5.0_M3 A bit surprised that only one package got upgraded: DEBUG: Command: opkg upgrade Status: 0 Output: Upgrading libexpat1 (2.6.1-r0) to libexpat1 (2.6.2) on root Downloading http://192.168.7.1:44893/core2-64/libexpat1_2.6.2-r0_core2-64.ipk. Removing obsolete file /usr/lib/libexpat.so.1.9.1. Configuring libexpat1. Test with a more complete image than core-image-full-cmdline? --- .../lib/oeqa/runtime/cases/opkg_sysupgrade.py | 71 +++++++++++++++++++ scripts/oe-test-system-upgrade | 34 +++++++++ 2 files changed, 105 insertions(+) create mode 100644 meta/lib/oeqa/runtime/cases/opkg_sysupgrade.py create mode 100755 scripts/oe-test-system-upgrade diff --git a/meta/lib/oeqa/runtime/cases/opkg_sysupgrade.py b/meta/lib/oeqa/runtime/cases/opkg_sysupgrade.py new file mode 100644 index 0000000000..7431db9198 --- /dev/null +++ b/meta/lib/oeqa/runtime/cases/opkg_sysupgrade.py @@ -0,0 +1,71 @@ +# +# Copyright OpenEmbedded Contributors +# +# Test that generated ipk packages can be used to upgrade +# an older image version. +# +# This is done by the scripts/oe-test-system-upgrade script +# replacing the fresh generated image by the older image +# generated by the Yocto Project autobuilder. +# +# Here, we then replace the original package feeds by our own. +# This test is not meant to be used as a regular "testimage" test +# run on the fresh image. +# +# SPDX-License-Identifier: MIT +# + +import os +from oeqa.utils.httpserver import HTTPService +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature, skipIfFeature +from oeqa.runtime.decorator.package import OEHasPackage + +class OpkgSysUpgradeTest(OERuntimeTestCase): + + def pkg(self, command, expected = 0): + command = 'opkg %s' % command + status, output = self.target.run(command, 1500) + message = os.linesep.join([command, output]) + self.assertEqual(status, expected, message) + return output + +class OpkgRepoTest(OpkgSysUpgradeTest): + + @classmethod + def setUp(cls): + service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK']) + cls.repo_server = HTTPService(service_repo, + '0.0.0.0', port=cls.tc.target.server_port, + logger=cls.tc.logger) + cls.repo_server.start() + + @classmethod + def tearDown(cls): + cls.repo_server.stop() + + def setup_source_config_for_package_install(self): + source_server = 'http://%s:%s' % (self.tc.target.server_ip, self.repo_server.port) + sourceslist_dir = '/etc/opkg' + pkgarch = self.tc.td["TUNE_PKGARCH"] + machinedir = self.tc.td["MACHINE"].replace("-", "_") + self.target.run('cd %s; echo src/gz all %s/all > base-feeds.conf' % (sourceslist_dir, source_server)) + self.target.run('cd %s; echo src/gz %s %s/%s >> base-feeds.conf' % (sourceslist_dir, pkgarch, source_server, pkgarch)) + self.target.run('cd %s; echo src/gz %s %s/%s >> base-feeds.conf' % (sourceslist_dir, machinedir, source_server, machinedir)) + + def cleanup_source_config_for_package_install(self): + sourceslist_dir = '/etc/opkg' + self.target.run('rm -rf %s; mv %s.orig %s' % (sourceslist_dir, sourceslist_dir, sourceslist_dir)) + + @skipIfNotFeature('package-management', + 'Test requires package-management to be in IMAGE_FEATURES') + @skipIfNotDataVar('IMAGE_PKGTYPE', 'ipk', + 'IPK is not the primary package manager') + @skipIfFeature('read-only-rootfs', + 'Test does not work with read-only-rootfs in IMAGE_FEATURES') + @OEHasPackage(['opkg']) + def test_opkg_system_upgrade_from_repo(self): + self.setup_source_config_for_package_install() + self.pkg('update') + self.pkg('upgrade') + diff --git a/scripts/oe-test-system-upgrade b/scripts/oe-test-system-upgrade new file mode 100755 index 0000000000..0d36a70a8a --- /dev/null +++ b/scripts/oe-test-system-upgrade @@ -0,0 +1,34 @@ +#!/bin/sh +# Proof of concept script to test that generated ipk packages can +# be used to upgrade an older image version. +# +# This is done by generating an image but then replacing it +# by an older image shared by the Yocto Project autobuilder. +# We then run QEMU on the old image and replace the original +# original package feeds by our own. + +IMAGE=core-image-full-cmdline +MILESTONE=yocto-5.0_M3 +MACHINE=qemux86-64 +MACHINE_VARIANT=-alt +IMAGE_FILE=$IMAGE-$MACHINE.rootfs.ext4 +IMAGE_PATH=tmp/deploy/images/$MACHINE/$IMAGE_FILE +PACKAGE_TYPE=ipk + +# Need a configuration with poky-alt, package_management, ipk package +# Need to build a full image to build the .json file needed by QEMU. +# Therefore, it is not sufficient to run only "package_write_ipk" for the image. + +bitbake $IMAGE +bitbake package-index + +# Download image to test +# Remove the link to the generated image if any + +rm -f $IMAGE_PATH +wget -O $IMAGE_PATH https://downloads.yoctoproject.org/releases/yocto/milestones/$MILESTONE/machines/qemu/$MACHINE$MACHINE_VARIANT/$IMAGE_FILE + +# Run test + +echo "TEST_SUITES=\"opkg_sysupgrade\"" > conf/auto.conf +bitbake $IMAGE -c testimage -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#198191): https://lists.openembedded.org/g/openembedded-core/message/198191 Mute This Topic: https://lists.openembedded.org/mt/105496743/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-