summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-12-11 23:26:32 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-13 16:32:21 +0000
commit778f3ce1e66ebc517a36d8567b5debbf317be343 (patch)
tree6dbd527b9e1594e664afa89a47e3d81f552e3fa9 /meta
parent3bf7cd71824edf71400fb046f04978ef6fa83a31 (diff)
downloadpoky-778f3ce1e66ebc517a36d8567b5debbf317be343.tar.gz
oeqa/sdk: clarify ELF assertion message
For example, instead of saying "3 != 62", say "Binary was x86-64 but expected i586". (From OE-Core rev: 9ab94cea589fca4394ec1fd8dc06b23fd8e990b9) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/sdk/case.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/meta/lib/oeqa/sdk/case.py b/meta/lib/oeqa/sdk/case.py
index ea15d6a107..d8611c8b30 100644
--- a/meta/lib/oeqa/sdk/case.py
+++ b/meta/lib/oeqa/sdk/case.py
@@ -1,6 +1,7 @@
1# Copyright (C) 2016 Intel Corporation 1# Copyright (C) 2016 Intel Corporation
2# Released under the MIT license (see COPYING.MIT) 2# Released under the MIT license (see COPYING.MIT)
3 3
4import os
4import subprocess 5import subprocess
5 6
6from oeqa.core.case import OETestCase 7from oeqa.core.case import OETestCase
@@ -26,11 +27,13 @@ class OESDKTestCase(OETestCase):
26 return tarball 27 return tarball
27 28
28 def check_elf(self, path, target_os=None, target_arch=None): 29 def check_elf(self, path, target_os=None, target_arch=None):
30 """
31 Verify that the ELF binary $path matches the specified target
32 OS/architecture, or if not specified the currently configured MACHINE's
33 OS/architecture.
34 """
29 import oe.qa, oe.elf 35 import oe.qa, oe.elf
30 36
31 elf = oe.qa.ELFFile(path)
32 elf.open()
33
34 if not target_os or not target_arch: 37 if not target_os or not target_arch:
35 output = self._run("echo $OECORE_TARGET_OS:$OECORE_TARGET_ARCH") 38 output = self._run("echo $OECORE_TARGET_OS:$OECORE_TARGET_ARCH")
36 target_os, target_arch = output.strip().split(":") 39 target_os, target_arch = output.strip().split(":")
@@ -38,7 +41,11 @@ class OESDKTestCase(OETestCase):
38 machine_data = oe.elf.machine_dict(None)[target_os][target_arch] 41 machine_data = oe.elf.machine_dict(None)[target_os][target_arch]
39 (machine, osabi, abiversion, endian, bits) = machine_data 42 (machine, osabi, abiversion, endian, bits) = machine_data
40 43
41 self.assertEqual(machine, elf.machine()) 44 elf = oe.qa.ELFFile(path)
45 elf.open()
46
47 self.assertEqual(machine, elf.machine(),
48 "Binary was %s but expected %s" %
49 (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine)))
42 self.assertEqual(bits, elf.abiSize()) 50 self.assertEqual(bits, elf.abiSize())
43 self.assertEqual(endian, elf.isLittleEndian()) 51 self.assertEqual(endian, elf.isLittleEndian())
44