1 #-------------------------------------------------------------------------------
4 # Karl Vogel (karl.vogel@gmail.com)
5 # Eli Bendersky (eliben@gmail.com)
7 # This code is in the public domain
8 #-------------------------------------------------------------------------------
12 from elftools
.elf
.elffile
import ELFFile
15 class TestMIPSSupport(unittest
.TestCase
):
17 with
open(os
.path
.join('test', 'testfiles_for_unittests',
18 'simple_gcc.elf.mips'), 'rb') as f
:
20 self
.assertEqual(elf
.get_machine_arch(), 'MIPS')
22 # Check some other properties of this ELF file derived from readelf
23 self
.assertEqual(elf
['e_entry'], 0x0)
24 self
.assertEqual(elf
.num_sections(), 25)
25 self
.assertEqual(elf
.num_segments(), 0)
27 # Test that Mips-specific section types work; these types are
28 # available only when the file is identified as MIPS in the
29 # e_machine header field.
30 sec9
= elf
.get_section(9)
31 self
.assertEqual(sec9
['sh_type'], 'SHT_MIPS_DWARF')
34 if __name__
== '__main__':