From b2cc09bd603477ec81716153465382644b13c53b Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 17 Jan 2013 16:23:07 +1100 Subject: [PATCH] Add a test for parsing an ARM ELF file. --- test/test_arm_support.py | 23 +++++++++++++++++++++++ test/testfiles/simple_gcc.elf.arm | Bin 0 -> 34827 bytes 2 files changed, 23 insertions(+) create mode 100644 test/test_arm_support.py create mode 100644 test/testfiles/simple_gcc.elf.arm diff --git a/test/test_arm_support.py b/test/test_arm_support.py new file mode 100644 index 0000000..6ea3969 --- /dev/null +++ b/test/test_arm_support.py @@ -0,0 +1,23 @@ +try: + import unittest2 as unittest +except ImportError: + import unittest +import sys +import os + +sys.path.extend(['.', '..']) +from elftools.elf.elffile import ELFFile + +class TestARMSupport(unittest.TestCase): + def test_hello(self): + with open(os.path.join('test', 'testfiles', 'simple_gcc.elf.arm'), 'rb') as f: + elf = ELFFile(f) + self.assertEqual(elf.get_machine_arch(), 'ARM') + + # Check some other properties of this ELF file derived from readelf + self.assertEqual(elf['e_entry'], 0x8018) + self.assertEqual(elf.num_sections(), 14) + self.assertEqual(elf.num_segments(), 2) + +if __name__ == '__main__': + sys.exit(unittest.main()) diff --git a/test/testfiles/simple_gcc.elf.arm b/test/testfiles/simple_gcc.elf.arm new file mode 100644 index 0000000000000000000000000000000000000000..b6783938a0abee45d9bb6ea634f83cbe04a14269 GIT binary patch literal 34827 zcmeH|&u<%55XWb2=SPz?P0}Eug20GW4HR!2a+W!c!9#x#zr^#+m? zTOn~lNIh{PYK}qb!G|1r013e#KqSPO#>G;5qY?*t3g6lFvsY0ot{lEknw|N+nK%3P z^VaJx<`>_yEKAHt$%LpH3q=a>;VqGrNLN9!@Dnm9{ZU?!H@1&ZtqZ1ex_%#iACcM+ z^eC(w7OhdwK>{Q|0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2J zBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKmsH{0wh2JBtQZrKms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