Fix for mixed version loclists, tests (#521)
[pyelftools.git] / test / test_dwarf_range_lists.py
1 #-------------------------------------------------------------------------------
2 # elftools tests
3 #
4 # Eli Bendersky (eliben@gmail.com), Santhosh Kumar Mani (santhoshmani@gmail.com)
5 # This code is in the public domain
6 #-------------------------------------------------------------------------------
7 import os
8 import unittest
9
10 from elftools.elf.elffile import ELFFile
11
12
13 class TestRangeLists(unittest.TestCase):
14 # Test the absence of .debug_ranges section
15 def test_range_list_absence(self):
16 with open(os.path.join('test', 'testfiles_for_unittests',
17 'arm_with_form_indirect.elf'), 'rb') as f:
18 elffile = ELFFile(f)
19 self.assertTrue(elffile.has_dwarf_info())
20 self.assertIsNone(elffile.get_dwarf_info().range_lists())
21
22 # Test the presence of .debug_ranges section
23 def test_range_list_presence(self):
24 with open(os.path.join('test', 'testfiles_for_unittests',
25 'sample_exe64.elf'), 'rb') as f:
26 elffile = ELFFile(f)
27 self.assertTrue(elffile.has_dwarf_info())
28 self.assertIsNotNone(elffile.get_dwarf_info().range_lists())
29
30
31 if __name__ == '__main__':
32 unittest.main()