From e8c6c366ff3072bb891821efe2f189b381c80e53 Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Thu, 27 Feb 2025 22:47:31 +0100 Subject: [PATCH] testing in the test for missing obj files --- tests/test_example_elfs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_example_elfs.py b/tests/test_example_elfs.py index 5cfb445..6fa631a 100644 --- a/tests/test_example_elfs.py +++ b/tests/test_example_elfs.py @@ -1,11 +1,15 @@ import pelfy import glob + def known_name(text: str): return not text.isnumeric() and not text.startswith('0x') + def test_simple_c(): - for path in glob.glob('tests/obj/*.o'): + file_list = glob.glob('tests/obj/*.o') + assert file_list, "No test object files found" + for path in file_list: print(f'Open {path}...') elf = pelfy.open_elf_file(path) @@ -24,5 +28,6 @@ def test_simple_c(): for reloc in elf.get_relocations(): assert known_name(reloc.type), f"Relocation type {reloc.type} for {elf.architecture} in {path} is unknown." + if __name__ == '__main__': test_simple_c()