poky/meta/lib/oeqa/selftest/cases/oelib/elf.py
Khem Raj 025343ed6e insane: Recognise BPF as a valid EM_MACHINE type
BPF Linux ELF objects are generated with kernel-selftests with
>= 4.18 kernel and when clang is enabled which packages BPF objects
into packages, therefore recongnise this as a valid ELF target

Add a selftest for BPF

Do not flag BPF objects in target, since they pretty much will be ok for
most of kernels architectures we care do support BPF

(From OE-Core rev: 3667a8ec016bae3f8026ef7b4c895546804f6368)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-13 17:38:07 +01:00

23 lines
1.1 KiB
Python

from unittest.case import TestCase
import oe.qa
class TestElf(TestCase):
def test_machine_name(self):
"""
Test elf_machine_to_string()
"""
self.assertEqual(oe.qa.elf_machine_to_string(0x02), "SPARC")
self.assertEqual(oe.qa.elf_machine_to_string(0x03), "x86")
self.assertEqual(oe.qa.elf_machine_to_string(0x08), "MIPS")
self.assertEqual(oe.qa.elf_machine_to_string(0x14), "PowerPC")
self.assertEqual(oe.qa.elf_machine_to_string(0x28), "ARM")
self.assertEqual(oe.qa.elf_machine_to_string(0x2A), "SuperH")
self.assertEqual(oe.qa.elf_machine_to_string(0x32), "IA-64")
self.assertEqual(oe.qa.elf_machine_to_string(0x3E), "x86-64")
self.assertEqual(oe.qa.elf_machine_to_string(0xB7), "AArch64")
self.assertEqual(oe.qa.elf_machine_to_string(0xF7), "BPF")
self.assertEqual(oe.qa.elf_machine_to_string(0x00), "Unknown (0)")
self.assertEqual(oe.qa.elf_machine_to_string(0xDEADBEEF), "Unknown (3735928559)")
self.assertEqual(oe.qa.elf_machine_to_string("foobar"), "Unknown ('foobar')")