LIEF/tests/elf/test_builder.py
Romain Thomas 4b649ad231 WIP
2018-09-08 05:25:21 +02:00

57 lines
1.3 KiB
Python

#!/usr/bin/env python
import unittest
import lief
import tempfile
import sys
import subprocess
import stat
import os
import logging
import random
import itertools
from lief import Logger
Logger.set_level(lief.LOGGING_LEVEL.WARNING)
from unittest import TestCase
from utils import get_sample
class TestBuilder(TestCase):
def setUp(self):
self.logger = logging.getLogger(__name__)
def test_simple(self):
binall = lief.parse(get_sample('ELF/ELF32_x86_binary_all.bin'))
def test_sectionless(self):
binall = lief.parse(get_sample('ELF/ELF64_x86-64_binary_rvs.bin'))
def test_library(self):
binall = lief.parse(get_sample('ELF/ELF64_x86-64_library_libadd.so'))
def test_object(self):
binall = lief.parse(get_sample('ELF/ELF64_x86-64_object_builder.o'))
def test_android(self):
binall = lief.parse(get_sample('ELF/ELF64_AArch64_piebinary_ndkr16.bin'))
def test_corrupted(self):
binall = lief.parse(get_sample('ELF/ELF32_x86_library_libshellx.so'))
def test_gcc(self):
binall = lief.parse(get_sample('ELF/ELF32_x86_binary_gcc.bin'))
if __name__ == '__main__':
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
root_logger.addHandler(ch)
unittest.main(verbosity=2)