summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2020-08-27 12:59:31 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-28 07:08:37 +0100
commit2f7f9bc0f1bfc22b2b252cd394a69facba60b5ca (patch)
tree24b7ffb35acb1c2bcec548205269f27fc4473f53 /meta
parentd707fa30f8a24d1e50831846330757254f245791 (diff)
downloadpoky-2f7f9bc0f1bfc22b2b252cd394a69facba60b5ca.tar.gz
oeqa/x32lib: rework to use readelf from the host
It is difficult and error-prone to ensure binutils gets installed into target images where this test may run; on the other hand readelf is always present on the host, as it is a part of HOSTTOOLS. (From OE-Core rev: ecf9fbf7938c667cb648a34f690cfa8db6f5c157) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/runtime/cases/x32lib.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oeqa/runtime/cases/x32lib.py b/meta/lib/oeqa/runtime/cases/x32lib.py
index ddf220140e..f419c8f181 100644
--- a/meta/lib/oeqa/runtime/cases/x32lib.py
+++ b/meta/lib/oeqa/runtime/cases/x32lib.py
@@ -6,16 +6,21 @@ from oeqa.runtime.case import OERuntimeTestCase
6from oeqa.core.decorator.depends import OETestDepends 6from oeqa.core.decorator.depends import OETestDepends
7from oeqa.core.decorator.data import skipIfNotInDataVar 7from oeqa.core.decorator.data import skipIfNotInDataVar
8 8
9import subprocess
10
9class X32libTest(OERuntimeTestCase): 11class X32libTest(OERuntimeTestCase):
10 12
11 @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32', 13 @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32',
12 'DEFAULTTUNE is not set to x86-64-x32') 14 'DEFAULTTUNE is not set to x86-64-x32')
13 @OETestDepends(['ssh.SSHTest.test_ssh']) 15 @OETestDepends(['ssh.SSHTest.test_ssh'])
14 def test_x32_file(self): 16 def test_x32_file(self):
15 cmd = 'readelf -h /bin/ls | grep Class | grep ELF32' 17 dest = self.td.get('T', '') + "/ls.x32test"
16 status1 = self.target.run(cmd)[0] 18 self.target.copyFrom("/bin/ls", dest)
17 cmd = 'readelf -h /bin/ls | grep Machine | grep X86-64' 19 cmd = 'readelf -h {} | grep Class | grep ELF32'.format(dest)
18 status2 = self.target.run(cmd)[0] 20 status1 = subprocess.call(cmd, shell=True)
19 msg = ("/bin/ls isn't an X86-64 ELF32 binary. readelf says: %s" % 21 cmd = 'readelf -h {} | grep Machine | grep X86-64'.format(dest)
20 self.target.run("readelf -h /bin/ls")[1]) 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)
21 self.assertTrue(status1 == 0 and status2 == 0, msg=msg) 26 self.assertTrue(status1 == 0 and status2 == 0, msg=msg)