summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/oelib/elf.py
blob: 5a5f9b4fdf6e9e9c5d5e94b7e149f0df414410a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# SPDX-License-Identifier: MIT
#

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), "Unset")
        self.assertEqual(oe.qa.elf_machine_to_string(0xDEADBEEF), "Unknown (3735928559)")
        self.assertEqual(oe.qa.elf_machine_to_string("foobar"), "Unknown ('foobar')")