From 494ce81192c1c767d9eb8b76a75da0f3e9e38d38 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 5 Sep 2018 05:42:10 -0700 Subject: [PATCH] Move arm reloc test to proper location and simplify its code a bit --- .../test_arm_call_reloc.py | 16 +++++++--------- test/test_dwarf_expr.py | 2 -- 2 files changed, 7 insertions(+), 11 deletions(-) rename test_arm_call_reloc.py => test/test_arm_call_reloc.py (78%) mode change 100755 => 100644 diff --git a/test_arm_call_reloc.py b/test/test_arm_call_reloc.py old mode 100755 new mode 100644 similarity index 78% rename from test_arm_call_reloc.py rename to test/test_arm_call_reloc.py index 8a2eac5..354c3a7 --- a/test_arm_call_reloc.py +++ b/test/test_arm_call_reloc.py @@ -26,22 +26,20 @@ def do_relocation(rel_elf): rel = rel_elf.get_section_by_name('.rel.text') rh.apply_section_relocations(stream, rel) - return data.getvalue() - - #stream.seek(0) - #data = stream.readlines() - - #return data + return stream.getvalue() class TestARMRElocation(unittest.TestCase): def test_reloc(self): - test_dir = os.path.joinjoin('test', 'testfiles_for_unittests') - with open(join(test_dir, 'arm_reloc_unrelocated.o'), 'rb') as rel_f, \ - open(join(test_dir, 'arm_reloc_relocated.elf'), 'rb') as f: + test_dir = os.path.join('test', 'testfiles_for_unittests') + with open(os.path.join(test_dir, 'arm_reloc_unrelocated.o'), 'rb') as rel_f, \ + open(os.path.join(test_dir, 'arm_reloc_relocated.elf'), 'rb') as f: rel_elf = ELFFile(rel_f) elf = ELFFile(f) # Comparison of '.text' section data self.assertEquals(do_relocation(rel_elf), elf.get_section_by_name('.text').data()) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_dwarf_expr.py b/test/test_dwarf_expr.py index 747ee38..a04c206 100644 --- a/test/test_dwarf_expr.py +++ b/test/test_dwarf_expr.py @@ -68,5 +68,3 @@ class TestExprDumper(unittest.TestCase): if __name__ == '__main__': unittest.main() - - -- 2.30.2