[yocto] [[AUH] 3/6] upgradehelper.py: Add support for specify what image test.

Aníbal Limón anibal.limon at linux.intel.com
Tue Dec 1 14:03:38 PST 2015


Before this commit core-image-sato was hardcoded for image
to test with this commit image name can be specified in
the upgrade-helper.conf.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 README               |  1 +
 modules/testimage.py | 10 +++++-----
 upgradehelper.py     | 13 ++++++++-----
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/README b/README
index 0756fdc..1c8eba1 100644
--- a/README
+++ b/README
@@ -68,6 +68,7 @@ machines=qemux86 qemux86-64 qemuarm qemumips qemuppc
 # optional features
 buildhistory=no
 testimage=no
+testimage_name=image-custom # defaults to core-image-sato
 
 --------------- snip ---------------
 
diff --git a/modules/testimage.py b/modules/testimage.py
index 3fbbc19..e410111 100644
--- a/modules/testimage.py
+++ b/modules/testimage.py
@@ -153,18 +153,18 @@ class TestImage():
                         f.write(line)
                     f.write("END: PTEST for %s\n" % machine)
 
-    def sato(self, machine):
+    def testimage(self, machine, image):
         os.environ['CORE_IMAGE_EXTRA_INSTALL'] = \
             self._get_pkgs_to_install(self.pkgs_ctx)
 
         if 'TEST_SUITES' in os.environ:
             del os.environ['TEST_SUITES']
 
-        I( "   building core-image-sato for %s ..." % machine)
-        self.bb.complete("core-image-sato", machine)
+        I( "   building %s for %s ..." % (image, machine))
+        self.bb.complete(image, machine)
 
-        I( "   running core-image-sato/testimage for %s ..." % machine)
-        self.bb.complete("core-image-sato -c testimage", machine)
+        I( "   running %s/testimage for %s ..." % (image, machine))
+        self.bb.complete("%s -c testimage" % image, machine)
 
         log_file = self._find_log("log.do_testimage", machine)
         shutil.copyfile(log_file,
diff --git a/upgradehelper.py b/upgradehelper.py
index 7dbfbeb..db39601 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -68,6 +68,7 @@ help_text = """Usage examples:
     $ upgrade-helper.py all
 """
 
+DEFAULT_TESTIMAGE = 'core-image-sato'
 
 def parse_cmdline():
     parser = argparse.ArgumentParser(description='Package Upgrade Helper',
@@ -314,8 +315,8 @@ class Updater(object):
             "The recipe has ptest enabled and has been tested with core-image-minimal/ptest \n" \
             "with the next machines %s. Attached is the log file.\n\n"
 
-        testimage_sato_info = \
-            "The recipe has been tested using core-image-sato testimage and succeeded with \n" \
+        testimage_info = \
+            "The recipe has been tested using %s testimage and succeeded with \n" \
             "the next machines %s. Attached is the log file.\n\n" \
 
         mail_footer = \
@@ -353,7 +354,8 @@ class Updater(object):
                 msg_body += testimage_ptest_info % machines
             if 'testimage' in pkg_ctx:
                 machines = pkg_ctx['testimage'].keys()
-                msg_body += testimage_sato_info % machines
+                msg_body += testimage_info % (settings.get('testimage_name', \
+                    DEFAULT_TESTIMAGE), machines)
 
         msg_body += mail_footer
 
@@ -602,10 +604,11 @@ class Updater(object):
                             import traceback
                             traceback.print_exc(file=sys.stdout)
 
+                    image = settings.get('testimage_name', DEFAULT_TESTIMAGE)
                     try:
-                        tim.sato(machine)
+                        tim.testimage(machine, image)
                     except Exception as e:
-                        E(" core-image-sato/testimage on machine %s failed" % machine)
+                        E(" %s/testimage on machine %s failed" % (image, machine))
                         if isinstance(e, Error):
                             E(" %s" % e.stdout)
                         else:
-- 
2.1.4




More information about the yocto mailing list