From 293b0f278f6279c41faeeacd6d80d2ccb837553f Mon Sep 17 00:00:00 2001 From: Yann Rouillard Date: Tue, 30 Apr 2013 01:40:00 +0200 Subject: [PATCH] Added unit test for solaris (SUNW_syminfo section only for now) --- test/test_solaris_support.py | 50 ++++++++++++++++++++++ test/testfiles/exe_solaris32_cc.elf | Bin 0 -> 6488 bytes test/testfiles/exe_solaris32_cc.elf.sparc | Bin 0 -> 5620 bytes test/testfiles/exe_solaris64_cc.elf | Bin 0 -> 9128 bytes test/testfiles/exe_solaris64_cc.elf.sparc | Bin 0 -> 7808 bytes 5 files changed, 50 insertions(+) create mode 100644 test/test_solaris_support.py create mode 100755 test/testfiles/exe_solaris32_cc.elf create mode 100755 test/testfiles/exe_solaris32_cc.elf.sparc create mode 100755 test/testfiles/exe_solaris64_cc.elf create mode 100755 test/testfiles/exe_solaris64_cc.elf.sparc diff --git a/test/test_solaris_support.py b/test/test_solaris_support.py new file mode 100644 index 0000000..9ad535c --- /dev/null +++ b/test/test_solaris_support.py @@ -0,0 +1,50 @@ +#------------------------------------------------------------------------------- +# elftools tests +# +# Yann Rouillard (yann@pleiades.fr.eu.org) +# This code is in the public domain +#------------------------------------------------------------------------------- +try: + import unittest2 as unittest +except ImportError: + import unittest +import os + +from utils import setup_syspath; setup_syspath() +from elftools.elf.elffile import ELFFile +from elftools.elf.constants import SYMINF0_FLAGS + + +class TestSolarisSupport(unittest.TestCase): + + def _test_SUNW_syminfo_section_generic(self, testfile): + with open(os.path.join('test', 'testfiles', + testfile), 'rb') as f: + elf = ELFFile(f) + syminfo_section = elf.get_section_by_name('.SUNW_syminfo') + self.assertIsNotNone(syminfo_section) + + exit_symbols = [s for s in syminfo_section.iter_symbols() + if 'exit' in s.name] + self.assertNotEqual(len(exit_symbols), 0) + + for symbol in exit_symbols: + self.assertEqual(symbol['si_boundto'], 0) + self.assertEqual(symbol['si_flags'], + SYMINF0_FLAGS.SYMINFO_FLG_DIRECT | + SYMINF0_FLAGS.SYMINFO_FLG_DIRECTBIND) + + def test_SUNW_syminfo_section_x86(self): + self._test_SUNW_syminfo_section_generic('exe_solaris32_cc.elf') + + def test_SUNW_syminfo_section_x64(self): + self._test_SUNW_syminfo_section_generic('exe_solaris64_cc.elf') + + def test_SUNW_syminfo_section_sparc32(self): + self._test_SUNW_syminfo_section_generic('exe_solaris32_cc.elf.sparc') + + def test_SUNW_syminfo_section_sparc64(self): + self._test_SUNW_syminfo_section_generic('exe_solaris64_cc.elf.sparc') + +if __name__ == '__main__': + unittest.main() diff --git a/test/testfiles/exe_solaris32_cc.elf b/test/testfiles/exe_solaris32_cc.elf new file mode 100755 index 0000000000000000000000000000000000000000..51b925cdc3f23678737f5f5cf1d64f2c3fe6cd3e GIT binary patch literal 6488 zcmeHMZH!b`89uYK3&VnCm$HhoZ7*htjfOkUE?*Wf?6LzTjtkw77G%qvyEAv#TW063 zbMJ0J*9dNCg9`>tf7IB-h%v!L4O(L~tqFxj+FEg`rWQ4oQbPybR1p+w7sltg=boL* zwxH=B6ZOzD?|IJqp7(sc_nhZ!KbuUgk3=FfB0{Dr5fv zx!%uL%NoY4y``-5)1{oPoHcdCl*)&)zYUuABC}tPnMthy=gRTUVkHu$BW5GdAwYVU z6yg?0t{u}nj#SLECx>W0nykmWAfV(OW2!{tla5Oru%fSF4i{tCD!MlN zw|2pe3768_pzE2%z^^a@U=^~$$e}~@7Yy9UJDHt;d8e==>kRefEn~>FvI4#{^4RLy z+I4Sh+eRayw_t_;pZ=FufVbjud|&D=c>MVlxI(JLTGYuziyQr`f@Kx7%<7-KYj{WT zyy98SGye``-X}coc?a=M(vW!%@s8rXvj~}I*xfj*W};Dw5)L*~Vu0P0xJb&&)}mBi z+>T$Ei}GT&=x6c5*)q~%w(O_w!nlv=p`TN{aLmW_)X(GP!ckyI@c{mfO?3W{=k&f~ zUQOvF6#YDvNeY@)QY;U@zJx|>9Z~4Po1mD?S-OzDL1RTN$h=P z4|dO+zxN{L=~tv~GB+#LB+lfUFo^1{pSb_Tp_?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