From 4c2dc7ab5b864f73de709d825190f2b0b83919f0 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Sat, 25 May 2013 05:56:37 -0700 Subject: [PATCH] Explicitly split test files for readelf and test files for unittests. This is so the readelf tests auto-discovery doens't accidentally find tests it's not supposed to. Also fixed some Python 3 compatibility issues in test_solaris_support --- test/run_readelf_tests.py | 2 +- test/test_arm_support.py | 2 +- test/test_solaris_support.py | 8 ++++---- .../exe_simple32.elf | Bin .../exe_simple64.elf | Bin .../exe_stripped64.elf | Bin .../libelf0_8_13_32bit.so.elf | Bin .../obj_simple32.o.elf | Bin .../penalty_32_gcc.o.elf | Bin .../penalty_64_clang.o.elf | Bin .../penalty_64_gcc.o.elf | Bin .../update32.o.elf | Bin .../exe_solaris32_cc.elf | Bin .../exe_solaris32_cc.elf.sparc | Bin .../exe_solaris64_cc.elf | Bin .../exe_solaris64_cc.elf.sparc | Bin .../simple_gcc.elf.arm | Bin 17 files changed, 6 insertions(+), 6 deletions(-) rename test/{testfiles => testfiles_for_readelf}/exe_simple32.elf (100%) rename test/{testfiles => testfiles_for_readelf}/exe_simple64.elf (100%) rename test/{testfiles => testfiles_for_readelf}/exe_stripped64.elf (100%) rename test/{testfiles => testfiles_for_readelf}/libelf0_8_13_32bit.so.elf (100%) rename test/{testfiles => testfiles_for_readelf}/obj_simple32.o.elf (100%) rename test/{testfiles => testfiles_for_readelf}/penalty_32_gcc.o.elf (100%) rename test/{testfiles => testfiles_for_readelf}/penalty_64_clang.o.elf (100%) rename test/{testfiles => testfiles_for_readelf}/penalty_64_gcc.o.elf (100%) rename test/{testfiles => testfiles_for_readelf}/update32.o.elf (100%) rename test/{testfiles => testfiles_for_unittests}/exe_solaris32_cc.elf (100%) mode change 100755 => 100644 rename test/{testfiles => testfiles_for_unittests}/exe_solaris32_cc.elf.sparc (100%) mode change 100755 => 100644 rename test/{testfiles => testfiles_for_unittests}/exe_solaris64_cc.elf (100%) mode change 100755 => 100644 rename test/{testfiles => testfiles_for_unittests}/exe_solaris64_cc.elf.sparc (100%) mode change 100755 => 100644 rename test/{testfiles => testfiles_for_unittests}/simple_gcc.elf.arm (100%) diff --git a/test/run_readelf_tests.py b/test/run_readelf_tests.py index 0c542d8..f9d07ac 100755 --- a/test/run_readelf_tests.py +++ b/test/run_readelf_tests.py @@ -183,7 +183,7 @@ def main(): if len(args) > 0: filenames = args else: - filenames = list(discover_testfiles('test/testfiles')) + filenames = list(discover_testfiles('test/testfiles_for_readelf')) success = True for filename in filenames: diff --git a/test/test_arm_support.py b/test/test_arm_support.py index b2b0ab2..0d7bfcc 100644 --- a/test/test_arm_support.py +++ b/test/test_arm_support.py @@ -15,7 +15,7 @@ from elftools.elf.elffile import ELFFile class TestARMSupport(unittest.TestCase): def test_hello(self): - with open(os.path.join('test', 'testfiles', + with open(os.path.join('test', 'testfiles_for_unittests', 'simple_gcc.elf.arm'), 'rb') as f: elf = ELFFile(f) self.assertEqual(elf.get_machine_arch(), 'ARM') diff --git a/test/test_solaris_support.py b/test/test_solaris_support.py index 0b7834c..59084c9 100644 --- a/test/test_solaris_support.py +++ b/test/test_solaris_support.py @@ -18,19 +18,19 @@ from elftools.elf.constants import SYMINFO_FLAGS class TestSolarisSupport(unittest.TestCase): def _test_SUNW_syminfo_section_generic(self, testfile): - with open(os.path.join('test', 'testfiles', + with open(os.path.join('test', 'testfiles_for_unittests', testfile), 'rb') as f: elf = ELFFile(f) - syminfo_section = elf.get_section_by_name('.SUNW_syminfo') + syminfo_section = elf.get_section_by_name(b'.SUNW_syminfo') self.assertIsNotNone(syminfo_section) # The test files were compiled against libc.so.1 with - # direct binding, hence the libc symbols used + # direct binding, hence the libc symbols used # (exit, atexit and _exit) have the direct binding flags # in the syminfo table. # We check that this is properly detected. exit_symbols = [s for s in syminfo_section.iter_symbols() - if 'exit' in s.name] + if b'exit' in s.name] self.assertNotEqual(len(exit_symbols), 0) for symbol in exit_symbols: diff --git a/test/testfiles/exe_simple32.elf b/test/testfiles_for_readelf/exe_simple32.elf similarity index 100% rename from test/testfiles/exe_simple32.elf rename to test/testfiles_for_readelf/exe_simple32.elf diff --git a/test/testfiles/exe_simple64.elf b/test/testfiles_for_readelf/exe_simple64.elf similarity index 100% rename from test/testfiles/exe_simple64.elf rename to test/testfiles_for_readelf/exe_simple64.elf diff --git a/test/testfiles/exe_stripped64.elf b/test/testfiles_for_readelf/exe_stripped64.elf similarity index 100% rename from test/testfiles/exe_stripped64.elf rename to test/testfiles_for_readelf/exe_stripped64.elf diff --git a/test/testfiles/libelf0_8_13_32bit.so.elf b/test/testfiles_for_readelf/libelf0_8_13_32bit.so.elf similarity index 100% rename from test/testfiles/libelf0_8_13_32bit.so.elf rename to test/testfiles_for_readelf/libelf0_8_13_32bit.so.elf diff --git a/test/testfiles/obj_simple32.o.elf b/test/testfiles_for_readelf/obj_simple32.o.elf similarity index 100% rename from test/testfiles/obj_simple32.o.elf rename to test/testfiles_for_readelf/obj_simple32.o.elf diff --git a/test/testfiles/penalty_32_gcc.o.elf b/test/testfiles_for_readelf/penalty_32_gcc.o.elf similarity index 100% rename from test/testfiles/penalty_32_gcc.o.elf rename to test/testfiles_for_readelf/penalty_32_gcc.o.elf diff --git a/test/testfiles/penalty_64_clang.o.elf b/test/testfiles_for_readelf/penalty_64_clang.o.elf similarity index 100% rename from test/testfiles/penalty_64_clang.o.elf rename to test/testfiles_for_readelf/penalty_64_clang.o.elf diff --git a/test/testfiles/penalty_64_gcc.o.elf b/test/testfiles_for_readelf/penalty_64_gcc.o.elf similarity index 100% rename from test/testfiles/penalty_64_gcc.o.elf rename to test/testfiles_for_readelf/penalty_64_gcc.o.elf diff --git a/test/testfiles/update32.o.elf b/test/testfiles_for_readelf/update32.o.elf similarity index 100% rename from test/testfiles/update32.o.elf rename to test/testfiles_for_readelf/update32.o.elf diff --git a/test/testfiles/exe_solaris32_cc.elf b/test/testfiles_for_unittests/exe_solaris32_cc.elf old mode 100755 new mode 100644 similarity index 100% rename from test/testfiles/exe_solaris32_cc.elf rename to test/testfiles_for_unittests/exe_solaris32_cc.elf diff --git a/test/testfiles/exe_solaris32_cc.elf.sparc b/test/testfiles_for_unittests/exe_solaris32_cc.elf.sparc old mode 100755 new mode 100644 similarity index 100% rename from test/testfiles/exe_solaris32_cc.elf.sparc rename to test/testfiles_for_unittests/exe_solaris32_cc.elf.sparc diff --git a/test/testfiles/exe_solaris64_cc.elf b/test/testfiles_for_unittests/exe_solaris64_cc.elf old mode 100755 new mode 100644 similarity index 100% rename from test/testfiles/exe_solaris64_cc.elf rename to test/testfiles_for_unittests/exe_solaris64_cc.elf diff --git a/test/testfiles/exe_solaris64_cc.elf.sparc b/test/testfiles_for_unittests/exe_solaris64_cc.elf.sparc old mode 100755 new mode 100644 similarity index 100% rename from test/testfiles/exe_solaris64_cc.elf.sparc rename to test/testfiles_for_unittests/exe_solaris64_cc.elf.sparc diff --git a/test/testfiles/simple_gcc.elf.arm b/test/testfiles_for_unittests/simple_gcc.elf.arm similarity index 100% rename from test/testfiles/simple_gcc.elf.arm rename to test/testfiles_for_unittests/simple_gcc.elf.arm -- 2.30.2