[oe-commits] [openembedded-core] 10/14: oeqa/sdk: clarify ELF assertion message

git at git.openembedded.org git at git.openembedded.org
Thu Dec 13 16:33:06 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 9ab94cea589fca4394ec1fd8dc06b23fd8e990b9
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Tue Dec 11 23:26:32 2018 +0000

    oeqa/sdk: clarify ELF assertion message
    
    For example, instead of saying "3 != 62", say "Binary was x86-64 but expected
    i586".
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/sdk/case.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/sdk/case.py b/meta/lib/oeqa/sdk/case.py
index ea15d6a..d8611c8 100644
--- a/meta/lib/oeqa/sdk/case.py
+++ b/meta/lib/oeqa/sdk/case.py
@@ -1,6 +1,7 @@
 # Copyright (C) 2016 Intel Corporation
 # Released under the MIT license (see COPYING.MIT)
 
+import os
 import subprocess
 
 from oeqa.core.case import OETestCase
@@ -26,11 +27,13 @@ class OESDKTestCase(OETestCase):
         return tarball
 
     def check_elf(self, path, target_os=None, target_arch=None):
+        """
+        Verify that the ELF binary $path matches the specified target
+        OS/architecture, or if not specified the currently configured MACHINE's
+        OS/architecture.
+        """
         import oe.qa, oe.elf
 
-        elf = oe.qa.ELFFile(path)
-        elf.open()
-
         if not target_os or not target_arch:
             output = self._run("echo $OECORE_TARGET_OS:$OECORE_TARGET_ARCH")
             target_os, target_arch = output.strip().split(":")
@@ -38,7 +41,11 @@ class OESDKTestCase(OETestCase):
         machine_data = oe.elf.machine_dict(None)[target_os][target_arch]
         (machine, osabi, abiversion, endian, bits) = machine_data
 
-        self.assertEqual(machine, elf.machine())
+        elf = oe.qa.ELFFile(path)
+        elf.open()
+
+        self.assertEqual(machine, elf.machine(),
+                         "Binary was %s but expected %s" %
+                         (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine)))
         self.assertEqual(bits, elf.abiSize())
         self.assertEqual(endian, elf.isLittleEndian())
-

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list