25 bfelf_loader_ut::test_bfelf_loader_relocate_invalid_loader()
27 auto ret = bfelf_loader_relocate(
nullptr);
32 bfelf_loader_ut::test_bfelf_loader_relocate_no_files_added()
34 bfelf_loader_t loader;
35 memset(&loader, 0,
sizeof(loader));
37 auto ret = bfelf_loader_relocate(&loader);
42 bfelf_loader_ut::test_bfelf_loader_relocate_uninitialized_files()
45 bfelf_file_t dummy_misc_ef;
46 bfelf_file_t dummy_code_ef;
48 ret = bfelf_file_init(m_dummy_misc.get(), m_dummy_misc_length, &dummy_misc_ef);
50 ret = bfelf_file_init(m_dummy_code.get(), m_dummy_code_length, &dummy_code_ef);
53 auto &&dummy_misc_pair = get_elf_exec(&dummy_misc_ef);
54 auto &&dummy_code_pair = get_elf_exec(&dummy_code_ef);
56 m_dummy_misc_exec = std::move(std::get<0>(dummy_misc_pair));
57 m_dummy_code_exec = std::move(std::get<0>(dummy_code_pair));
59 bfelf_loader_t loader;
60 memset(&loader, 0,
sizeof(loader));
62 ret = bfelf_loader_add(&loader, &dummy_misc_ef, m_dummy_misc_exec.get(), m_dummy_misc_exec.get());
64 ret = bfelf_loader_add(&loader, &dummy_code_ef, m_dummy_code_exec.get(), m_dummy_code_exec.get());
67 memset(&dummy_misc_ef, 0,
sizeof(dummy_misc_ef));
68 memset(&dummy_code_ef, 0,
sizeof(dummy_code_ef));
70 ret = bfelf_loader_relocate(&loader);
75 bfelf_loader_ut::test_bfelf_loader_relocate_twice()
78 bfelf_file_t dummy_misc_ef;
79 bfelf_file_t dummy_code_ef;
81 ret = bfelf_file_init(m_dummy_misc.get(), m_dummy_misc_length, &dummy_misc_ef);
83 ret = bfelf_file_init(m_dummy_code.get(), m_dummy_code_length, &dummy_code_ef);
86 auto &&dummy_misc_pair = get_elf_exec(&dummy_misc_ef);
87 auto &&dummy_code_pair = get_elf_exec(&dummy_code_ef);
89 m_dummy_misc_exec = std::move(std::get<0>(dummy_misc_pair));
90 m_dummy_code_exec = std::move(std::get<0>(dummy_code_pair));
92 bfelf_loader_t loader;
93 memset(&loader, 0,
sizeof(loader));
95 ret = bfelf_loader_add(&loader, &dummy_misc_ef, m_dummy_misc_exec.get(), m_dummy_misc_exec.get());
97 ret = bfelf_loader_add(&loader, &dummy_code_ef, m_dummy_code_exec.get(), m_dummy_code_exec.get());
100 ret = bfelf_loader_relocate(&loader);
103 ret = bfelf_loader_relocate(&loader);
108 bfelf_loader_ut::test_bfelf_loader_relocate_no_symbol()
111 bfelf_file_t dummy_code_ef;
113 ret = bfelf_file_init(m_dummy_code.get(), m_dummy_code_length, &dummy_code_ef);
116 auto &&dummy_code_pair = get_elf_exec(&dummy_code_ef);
117 auto &&dummy_code_exec = std::move(std::get<0>(dummy_code_pair));
119 bfelf_loader_t loader = {};
121 ret = bfelf_loader_add(&loader, &dummy_code_ef, dummy_code_exec.get(), dummy_code_exec.get());
124 ret = bfelf_loader_relocate(&loader);
void * memset(void *block, int c, size_t size)
#define BFELF_ERROR_INVALID_ARG
#define BFELF_ERROR_NO_SUCH_SYMBOL