[oe-commits] Ross Burton : oeqa/runtime/multilib: fix and improve multilib test

git at git.openembedded.org git at git.openembedded.org
Sat Aug 29 12:39:34 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: c51d24710b48eb3930edb8c661100705c6203e78
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=c51d24710b48eb3930edb8c661100705c6203e78

Author: Ross Burton <ross.burton at intel.com>
Date:   Sat Aug 29 00:43:13 2015 +0100

oeqa/runtime/multilib: fix and improve multilib test

Replace the previous shell magic with a Python function to parse the readelf
output, and fix the package names to include the lib32- prefix.

[ YOCTO #8219 ]

Signed-off-by: Ross Burton <ross.burton at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oeqa/runtime/multilib.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/multilib.py b/meta/lib/oeqa/runtime/multilib.py
index ab0a6cc..1c1729b 100644
--- a/meta/lib/oeqa/runtime/multilib.py
+++ b/meta/lib/oeqa/runtime/multilib.py
@@ -10,9 +10,22 @@ def setUpModule():
 
 class MultilibTest(oeRuntimeTest):
 
+    def parse(self, s):
+        """
+        Parse the output of readelf -h and return the binary class, or fail.
+        """
+        l = [l.split()[1] for l in s.split('\n') if "Class:" in l]
+        if l:
+            return l[0]
+        else:
+            self.fail("Cannot parse readelf output\n" + s)
+
     @testcase('279')
     @skipUnlessPassed('test_ssh')
     def test_file_connman(self):
-        self.assertTrue(oeRuntimeTest.hasPackage('connman-gnome'), msg="This test assumes connman-gnome is installed")
-        (status, output) = self.target.run("readelf -h /usr/bin/connman-applet | sed -n '3p' | awk '{print $2}'")
-        self.assertEqual(output, "ELF32", msg="connman-applet isn't an ELF32 binary. readelf says: %s" % self.target.run("readelf -h /usr/bin/connman-applet")[1])
+        self.assertTrue(oeRuntimeTest.hasPackage('lib32-connman-gnome'), msg="This test assumes lib32-connman-gnome is installed")
+
+        (status, output) = self.target.run("readelf -h /usr/bin/connman-applet")
+        self.assertEqual(status, 0, "Failed to readelf /usr/bin/connman-applet")
+        theclass = self.parse(output)
+        self.assertEqual(theclass, "ELF32", msg="connman-applet isn't ELF32 (is %s)" % theclass)



More information about the Openembedded-commits mailing list