aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/multilib.py
blob: 1c1729b84df644b94957f31ec385a454659ce9fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unittest
from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import *

def setUpModule():
    multilibs = oeRuntimeTest.tc.d.getVar("MULTILIBS", True) or ""
    if "multilib:lib32" not in multilibs:
        skipModule("this isn't a multilib:lib32 image")


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('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)