Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 5 | from oeqa.runtime.case import OERuntimeTestCase |
| 6 | from oeqa.core.decorator.depends import OETestDepends |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 7 | from oeqa.core.decorator.data import skipIfNotInDataVar |
| 8 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 9 | import subprocess |
| 10 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | class X32libTest(OERuntimeTestCase): |
| 12 | |
| 13 | @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32', |
| 14 | 'DEFAULTTUNE is not set to x86-64-x32') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 15 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 16 | def test_x32_file(self): |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 17 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | self.assertTrue(status1 == 0 and status2 == 0, msg=msg) |