Added license snippet to all files in the code. Whitespace cleanup.
[pyelftools.git] / test / test_arm_support.py
1 #-------------------------------------------------------------------------------
2 # elftools tests
3 #
4 # Eli Bendersky (eliben@gmail.com)
5 # This code is in the public domain
6 #-------------------------------------------------------------------------------
7 try:
8 import unittest2 as unittest
9 except ImportError:
10 import unittest
11 import sys
12 import os
13
14 sys.path.extend(['.', '..'])
15 from elftools.elf.elffile import ELFFile
16
17 class TestARMSupport(unittest.TestCase):
18 def test_hello(self):
19 with open(os.path.join('test', 'testfiles', 'simple_gcc.elf.arm'), 'rb') as f:
20 elf = ELFFile(f)
21 self.assertEqual(elf.get_machine_arch(), 'ARM')
22
23 # Check some other properties of this ELF file derived from readelf
24 self.assertEqual(elf['e_entry'], 0x8018)
25 self.assertEqual(elf.num_sections(), 14)
26 self.assertEqual(elf.num_segments(), 2)
27
28 if __name__ == '__main__':
29 sys.exit(unittest.main())
30