1 #-------------------------------------------------------------------------------
4 # Yann Rouillard (yann@pleiades.fr.eu.org)
5 # This code is in the public domain
6 #-------------------------------------------------------------------------------
8 import unittest2
as unittest
13 from utils
import setup_syspath
; setup_syspath()
14 from elftools
.elf
.elffile
import ELFFile
15 from elftools
.elf
.constants
import SYMINFO_FLAGS
18 class TestSolarisSupport(unittest
.TestCase
):
20 def _test_SUNW_syminfo_section_generic(self
, testfile
):
21 with
open(os
.path
.join('test', 'testfiles',
22 testfile
), 'rb') as f
:
24 syminfo_section
= elf
.get_section_by_name('.SUNW_syminfo')
25 self
.assertIsNotNone(syminfo_section
)
27 exit_symbols
= [s
for s
in syminfo_section
.iter_symbols()
29 self
.assertNotEqual(len(exit_symbols
), 0)
31 for symbol
in exit_symbols
:
32 self
.assertEqual(symbol
['si_boundto'], 0)
33 self
.assertEqual(symbol
['si_flags'],
34 SYMINFO_FLAGS
.SYMINFO_FLG_DIRECT |
35 SYMINFO_FLAGS
.SYMINFO_FLG_DIRECTBIND
)
37 def test_SUNW_syminfo_section_x86(self
):
38 self
._test
_SUNW
_syminfo
_section
_generic
('exe_solaris32_cc.elf')
40 def test_SUNW_syminfo_section_x64(self
):
41 self
._test
_SUNW
_syminfo
_section
_generic
('exe_solaris64_cc.elf')
43 def test_SUNW_syminfo_section_sparc32(self
):
44 self
._test
_SUNW
_syminfo
_section
_generic
('exe_solaris32_cc.elf.sparc')
46 def test_SUNW_syminfo_section_sparc64(self
):
47 self
._test
_SUNW
_syminfo
_section
_generic
('exe_solaris64_cc.elf.sparc')
49 if __name__
== '__main__':