File: test_pubtypes.py

package info (click to toggle)
python-pyelftools 0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,964 kB
  • sloc: python: 15,903; ansic: 298; asm: 86; makefile: 24; cpp: 18; sh: 4
file content (25 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (3)
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
#-------------------------------------------------------------------------------
# elftools tests
#
# Efimov Vasiliy (real@ispras.ru)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest

from elftools.elf.elffile import ELFFile


class TestEmptyPubtypes(unittest.TestCase):
    def test_empty_pubtypes(self):
        test_dir = os.path.join('test', 'testfiles_for_unittests')
        with open(os.path.join(test_dir, 'empty_pubtypes', 'main.elf'), 'rb') as f:
            elf = ELFFile(f)

            # This test targets `ELFParseError` caused by buggy handling
            # of ".debug_pubtypes" section which only has zero terminator
            # entry.
            self.assertEqual(len(elf.get_dwarf_info().get_pubtypes()), 0)

if __name__ == '__main__':
    unittest.main()