blob: f419c8f18179743d74165a1ef573e5fc88ef7f0f [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005from oeqa.runtime.case import OERuntimeTestCase
6from oeqa.core.decorator.depends import OETestDepends
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007from oeqa.core.decorator.data import skipIfNotInDataVar
8
Andrew Geisslerc9f78652020-09-18 14:11:35 -05009import subprocess
10
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011class X32libTest(OERuntimeTestCase):
12
13 @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32',
14 'DEFAULTTUNE is not set to x86-64-x32')
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015 @OETestDepends(['ssh.SSHTest.test_ssh'])
16 def test_x32_file(self):
Andrew Geisslerc9f78652020-09-18 14:11:35 -050017 dest = self.td.get('T', '') + "/ls.x32test"
18 self.target.copyFrom("/bin/ls", dest)
19 cmd = 'readelf -h {} | grep Class | grep ELF32'.format(dest)
20 status1 = subprocess.call(cmd, shell=True)
21 cmd = 'readelf -h {} | grep Machine | grep X86-64'.format(dest)
22 status2 = subprocess.call(cmd, shell=True)
23 msg = ("/bin/ls isn't an X86-64 ELF32 binary. readelf says:\n{}".format(
24 subprocess.check_output("readelf -h {}".format(dest), shell=True).decode()))
25 os.remove(dest)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026 self.assertTrue(status1 == 0 and status2 == 0, msg=msg)