From: Eli Bendersky Date: Sat, 25 May 2013 12:56:37 +0000 (-0700) Subject: Explicitly split test files for readelf and test files for unittests. X-Git-Tag: v0.22~55 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c2dc7ab5b864f73de709d825190f2b0b83919f0;p=pyelftools.git 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 --- 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/exe_simple32.elf deleted file mode 100644 index d6b3cd1..0000000 Binary files a/test/testfiles/exe_simple32.elf and /dev/null differ diff --git a/test/testfiles/exe_simple64.elf b/test/testfiles/exe_simple64.elf deleted file mode 100644 index ccfa6ae..0000000 Binary files a/test/testfiles/exe_simple64.elf and /dev/null differ diff --git a/test/testfiles/exe_solaris32_cc.elf b/test/testfiles/exe_solaris32_cc.elf deleted file mode 100755 index 51b925c..0000000 Binary files a/test/testfiles/exe_solaris32_cc.elf and /dev/null differ diff --git a/test/testfiles/exe_solaris32_cc.elf.sparc b/test/testfiles/exe_solaris32_cc.elf.sparc deleted file mode 100755 index 7e879ef..0000000 Binary files a/test/testfiles/exe_solaris32_cc.elf.sparc and /dev/null differ diff --git a/test/testfiles/exe_solaris64_cc.elf b/test/testfiles/exe_solaris64_cc.elf deleted file mode 100755 index b6bad65..0000000 Binary files a/test/testfiles/exe_solaris64_cc.elf and /dev/null differ diff --git a/test/testfiles/exe_solaris64_cc.elf.sparc b/test/testfiles/exe_solaris64_cc.elf.sparc deleted file mode 100755 index b9e4a17..0000000 Binary files a/test/testfiles/exe_solaris64_cc.elf.sparc and /dev/null differ diff --git a/test/testfiles/exe_stripped64.elf b/test/testfiles/exe_stripped64.elf deleted file mode 100644 index 841b3f8..0000000 Binary files a/test/testfiles/exe_stripped64.elf and /dev/null differ diff --git a/test/testfiles/libelf0_8_13_32bit.so.elf b/test/testfiles/libelf0_8_13_32bit.so.elf deleted file mode 100644 index c236625..0000000 Binary files a/test/testfiles/libelf0_8_13_32bit.so.elf and /dev/null differ diff --git a/test/testfiles/obj_simple32.o.elf b/test/testfiles/obj_simple32.o.elf deleted file mode 100644 index 5ce4182..0000000 Binary files a/test/testfiles/obj_simple32.o.elf and /dev/null differ diff --git a/test/testfiles/penalty_32_gcc.o.elf b/test/testfiles/penalty_32_gcc.o.elf deleted file mode 100644 index 4c5c5de..0000000 Binary files a/test/testfiles/penalty_32_gcc.o.elf and /dev/null differ diff --git a/test/testfiles/penalty_64_clang.o.elf b/test/testfiles/penalty_64_clang.o.elf deleted file mode 100644 index 91d207d..0000000 Binary files a/test/testfiles/penalty_64_clang.o.elf and /dev/null differ diff --git a/test/testfiles/penalty_64_gcc.o.elf b/test/testfiles/penalty_64_gcc.o.elf deleted file mode 100644 index aca100b..0000000 Binary files a/test/testfiles/penalty_64_gcc.o.elf and /dev/null differ diff --git a/test/testfiles/simple_gcc.elf.arm b/test/testfiles/simple_gcc.elf.arm deleted file mode 100644 index b678393..0000000 Binary files a/test/testfiles/simple_gcc.elf.arm and /dev/null differ diff --git a/test/testfiles/update32.o.elf b/test/testfiles/update32.o.elf deleted file mode 100644 index ae68ef9..0000000 Binary files a/test/testfiles/update32.o.elf and /dev/null differ diff --git a/test/testfiles_for_readelf/exe_simple32.elf b/test/testfiles_for_readelf/exe_simple32.elf new file mode 100644 index 0000000..d6b3cd1 Binary files /dev/null and b/test/testfiles_for_readelf/exe_simple32.elf differ diff --git a/test/testfiles_for_readelf/exe_simple64.elf b/test/testfiles_for_readelf/exe_simple64.elf new file mode 100644 index 0000000..ccfa6ae Binary files /dev/null and b/test/testfiles_for_readelf/exe_simple64.elf differ diff --git a/test/testfiles_for_readelf/exe_stripped64.elf b/test/testfiles_for_readelf/exe_stripped64.elf new file mode 100644 index 0000000..841b3f8 Binary files /dev/null and b/test/testfiles_for_readelf/exe_stripped64.elf differ diff --git a/test/testfiles_for_readelf/libelf0_8_13_32bit.so.elf b/test/testfiles_for_readelf/libelf0_8_13_32bit.so.elf new file mode 100644 index 0000000..c236625 Binary files /dev/null and b/test/testfiles_for_readelf/libelf0_8_13_32bit.so.elf differ diff --git a/test/testfiles_for_readelf/obj_simple32.o.elf b/test/testfiles_for_readelf/obj_simple32.o.elf new file mode 100644 index 0000000..5ce4182 Binary files /dev/null and b/test/testfiles_for_readelf/obj_simple32.o.elf differ diff --git a/test/testfiles_for_readelf/penalty_32_gcc.o.elf b/test/testfiles_for_readelf/penalty_32_gcc.o.elf new file mode 100644 index 0000000..4c5c5de Binary files /dev/null and b/test/testfiles_for_readelf/penalty_32_gcc.o.elf differ diff --git a/test/testfiles_for_readelf/penalty_64_clang.o.elf b/test/testfiles_for_readelf/penalty_64_clang.o.elf new file mode 100644 index 0000000..91d207d Binary files /dev/null and b/test/testfiles_for_readelf/penalty_64_clang.o.elf differ diff --git a/test/testfiles_for_readelf/penalty_64_gcc.o.elf b/test/testfiles_for_readelf/penalty_64_gcc.o.elf new file mode 100644 index 0000000..aca100b Binary files /dev/null and b/test/testfiles_for_readelf/penalty_64_gcc.o.elf differ diff --git a/test/testfiles_for_readelf/update32.o.elf b/test/testfiles_for_readelf/update32.o.elf new file mode 100644 index 0000000..ae68ef9 Binary files /dev/null and b/test/testfiles_for_readelf/update32.o.elf differ diff --git a/test/testfiles_for_unittests/exe_solaris32_cc.elf b/test/testfiles_for_unittests/exe_solaris32_cc.elf new file mode 100644 index 0000000..51b925c Binary files /dev/null and b/test/testfiles_for_unittests/exe_solaris32_cc.elf differ diff --git a/test/testfiles_for_unittests/exe_solaris32_cc.elf.sparc b/test/testfiles_for_unittests/exe_solaris32_cc.elf.sparc new file mode 100644 index 0000000..7e879ef Binary files /dev/null and b/test/testfiles_for_unittests/exe_solaris32_cc.elf.sparc differ diff --git a/test/testfiles_for_unittests/exe_solaris64_cc.elf b/test/testfiles_for_unittests/exe_solaris64_cc.elf new file mode 100644 index 0000000..b6bad65 Binary files /dev/null and b/test/testfiles_for_unittests/exe_solaris64_cc.elf differ diff --git a/test/testfiles_for_unittests/exe_solaris64_cc.elf.sparc b/test/testfiles_for_unittests/exe_solaris64_cc.elf.sparc new file mode 100644 index 0000000..b9e4a17 Binary files /dev/null and b/test/testfiles_for_unittests/exe_solaris64_cc.elf.sparc differ diff --git a/test/testfiles_for_unittests/simple_gcc.elf.arm b/test/testfiles_for_unittests/simple_gcc.elf.arm new file mode 100644 index 0000000..b678393 Binary files /dev/null and b/test/testfiles_for_unittests/simple_gcc.elf.arm differ