[oe-commits] [openembedded-core] 01/01: oeqa/selftest/imagefeatures: improve test_hypervisor_fmts

git at git.openembedded.org git at git.openembedded.org
Wed Oct 9 13:05:53 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 6a710ad0b445295991b17545f634684f4f317099
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Wed Oct 9 12:00:51 2019 +0100

    oeqa/selftest/imagefeatures: improve test_hypervisor_fmts
    
    If this test fails then the output doesn't help in any meaningful way, so
    improve the test to output the unparsable JSON and display unexpected output.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/imagefeatures.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py
index 8213d63..cf2a42a 100644
--- a/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -161,8 +161,12 @@ class ImageFeatures(OESelftestTestCase):
             sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal')
             result = runCmd('qemu-img info --output json %s' % image_path,
                             native_sysroot=sysroot)
-            self.assertTrue(json.loads(result.output).get('format') == itype,
-                            msg="Could not parse '%s'" % result.output)
+            try:
+                data = json.loads(result.output)
+                self.assertEqual(data.get('format'), itype,
+                                 msg="Unexpected format in '%s'" % (result.output))
+            except json.decoder.JSONDecodeError:
+                self.fail("Could not parse '%ss'" % result.output)
 
     def test_long_chain_conversion(self):
         """

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list