summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
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