[yocto] [[AUH] 12/17] upgradehelper.py: Add settings for enable testimage.
Aníbal Limón
anibal.limon at linux.intel.com
Wed Nov 25 16:00:41 PST 2015
Testimage feature will provide the ability to run testimage
class over a set of succesful upgrades.
Also it will run ptest on recipes that support ptest and retrive
the result for store/send to maintainer.
Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
README | 25 +++++++++++++++++++++++++
upgradehelper.py | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/README b/README
index ee1bd1f..6432f97 100644
--- a/README
+++ b/README
@@ -61,6 +61,7 @@ machines=qemux86 qemux86-64 qemuarm qemumips qemuppc
# optional features
buildhistory=no
+testimage=no
--------------- snip ---------------
@@ -93,6 +94,30 @@ $BUILDDIR/upgrade-helper/work/recipe/buildhistory-diff.txt.
(Do not remove any other inherited class in the process, e.g. distrodata).
+5. If you want to enable testimage (optional) you need to enable in
+upgrade-helper.conf also add the following lines to your conf/local.conf
+file:
+
+--------------- snip ---------------
+INHERIT += "testimage"
+
+EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
+# testimage/ptest only work with rpm
+PACKAGE_CLASSES = "package_rpm"
+--------------- snip ---------------
+
+Also if you are running in a server without X11 session, you need to start
+a vncserver example:
+
+$ vncserver :1
+$ export DISPLAY=:1
+
+If upgrade is succesful testimage/ptest results are generated into
+$BUILDDIR/upgrade-helper/work/recipe/ptest_recipe.log if recipe support
+ptest.
+
+(Do not remove any other inherited class in the process, e.g. distrodata).
+
Usage
-----
diff --git a/upgradehelper.py b/upgradehelper.py
index c841c2a..222909b 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -157,6 +157,7 @@ class Updater(object):
'qemux86 qemux86-64 qemuarm qemumips qemuppc').split()
self.opts['skip_compilation'] = skip_compilation
self.opts['buildhistory'] = self._buildhistory_is_enabled()
+ self.opts['testimage'] = self._testimage_is_enabled()
self.uh_dir = os.path.join(build_dir, "upgrade-helper")
if not os.path.exists(self.uh_dir):
@@ -211,6 +212,41 @@ class Updater(object):
return enabled
+ def _testimage_is_enabled(self):
+ enabled = False
+
+ if settings.get("testimage", "no") == "yes":
+ if 'testimage' in self.base_env['INHERIT']:
+ if not "ptest" in self.base_env["DISTRO_FEATURES"]:
+ E(" testimage requires ptest in DISTRO_FEATURES please add to"\
+ " conf/local.conf.")
+ exit(1)
+
+ if not "package-management" in self.base_env['EXTRA_IMAGE_FEATURES']:
+ E(" testimage requires package-management in EXTRA_IMAGE_FEATURES"\
+ " please add to conf/local.conf.")
+ exit(1)
+
+ if not "package_rpm" == self.base_env["PACKAGE_CLASSES"]:
+ E(" testimage/ptest requires PACKAGE_CLASSES set to package_rpm"\
+ " please add to conf/local.conf.")
+ exit(1)
+
+ enabled = True
+ else:
+ E(" testimage was enabled in upgrade-helper.conf"\
+ " but isn't INHERIT in conf/local.conf, if you want"\
+ " to enable please set.")
+ exit(1)
+ else:
+ if 'testimage' in self.base_env['INHERIT']:
+ E(" testimage was INHERIT in conf/local.conf"\
+ " but testimage=yes isn't in upgrade-helper.conf,"\
+ " if you want to enable please set.")
+ exit(1)
+
+ return enabled
+
def _get_packages_to_upgrade(self, packages=None):
if packages is None:
I( "Nothing to upgrade")
@@ -497,10 +533,8 @@ class Updater(object):
self.uh_recipes_failed_dir, pkg_ctx['PN']))
self.commit_changes(pkg_ctx)
-
self.statistics.update(pkg_ctx['PN'], pkg_ctx['NPV'],
pkg_ctx['MAINTAINER'], pkg_ctx['error'])
-
self.pkg_upgrade_handler(pkg_ctx)
if attempted_pkgs > 1:
--
2.1.4
More information about the yocto
mailing list