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