From a85ffc3920ea702c06b44cca28353556dbf9a415 Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Sat, 13 Jan 2024 21:04:20 -0500 Subject: [PATCH] Add unit tests for is_dynamic_elf() --- unittest/test_elf.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/unittest/test_elf.py b/unittest/test_elf.py index 4970420..6693267 100644 --- a/unittest/test_elf.py +++ b/unittest/test_elf.py @@ -115,3 +115,15 @@ def test_raspios(self): "/lib/ld-linux-armhf.so.3", ] self._test(output, exp) + + +def test_is_dynamic_elf_handles_non_elf(): + with NamedTemporaryFile('wb', suffix='.bin') as f: + f.write(b"\x11\x22\x33\x44") + f.flush() + + assert not elf.is_dynamic_elf(f.name) + + +def test_is_dynamic_elf_handles_elf(): + assert elf.is_dynamic_elf("/bin/true")