1# 2# Copyright OpenEmbedded Contributors 3# 4# SPDX-License-Identifier: MIT 5# 6 7from oeqa.runtime.case import OERuntimeTestCase 8from oeqa.core.decorator.depends import OETestDepends 9from oeqa.core.decorator.data import skipIfNotInDataVar 10 11import subprocess 12 13class X32libTest(OERuntimeTestCase): 14 15 @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32', 16 'DEFAULTTUNE is not set to x86-64-x32') 17 @OETestDepends(['ssh.SSHTest.test_ssh']) 18 def test_x32_file(self): 19 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) 28 self.assertTrue(status1 == 0 and status2 == 0, msg=msg) 29