testing in the test for missing obj files

This commit is contained in:
Nicolas Kruse 2025-02-27 22:47:31 +01:00
parent b37b54e561
commit e8c6c366ff
1 changed files with 6 additions and 1 deletions

View File

@ -1,11 +1,15 @@
import pelfy import pelfy
import glob import glob
def known_name(text: str): def known_name(text: str):
return not text.isnumeric() and not text.startswith('0x') return not text.isnumeric() and not text.startswith('0x')
def test_simple_c(): 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}...') print(f'Open {path}...')
elf = pelfy.open_elf_file(path) elf = pelfy.open_elf_file(path)
@ -24,5 +28,6 @@ def test_simple_c():
for reloc in elf.get_relocations(): for reloc in elf.get_relocations():
assert known_name(reloc.type), f"Relocation type {reloc.type} for {elf.architecture} in {path} is unknown." assert known_name(reloc.type), f"Relocation type {reloc.type} for {elf.architecture} in {path} is unknown."
if __name__ == '__main__': if __name__ == '__main__':
test_simple_c() test_simple_c()