25 bfelf_loader_ut::test_bfelf_file_get_section_info_invalid_elf_file()
29 auto ret = bfelf_file_get_section_info(
nullptr, &info);
34 bfelf_loader_ut::test_bfelf_file_get_section_info_invalid_info()
38 auto ret = bfelf_file_get_section_info(&ef,
nullptr);
43 bfelf_loader_ut::test_bfelf_file_get_section_info_expected_misc_resources()
46 bfelf_file_t dummy_misc_ef;
47 bfelf_file_t dummy_code_ef;
49 ret = bfelf_file_init(m_dummy_misc.get(), m_dummy_misc_length, &dummy_misc_ef);
51 ret = bfelf_file_init(m_dummy_code.get(), m_dummy_code_length, &dummy_code_ef);
54 auto &&dummy_misc_pair = get_elf_exec(&dummy_misc_ef);
55 auto &&dummy_code_pair = get_elf_exec(&dummy_code_ef);
57 m_dummy_misc_exec = std::move(std::get<0>(dummy_misc_pair));
58 m_dummy_code_exec = std::move(std::get<0>(dummy_code_pair));
60 bfelf_loader_t loader;
61 memset(&loader, 0,
sizeof(loader));
63 ret = bfelf_loader_add(&loader, &dummy_misc_ef, m_dummy_misc_exec.get(), m_dummy_misc_exec.get());
65 ret = bfelf_loader_add(&loader, &dummy_code_ef, m_dummy_code_exec.get(), m_dummy_code_exec.get());
68 ret = bfelf_loader_relocate(&loader);
73 ret = bfelf_file_get_section_info(&dummy_misc_ef, &info);
87 bfelf_loader_ut::test_bfelf_file_get_section_info_expected_code_resources()
90 bfelf_file_t dummy_misc_ef;
91 bfelf_file_t dummy_code_ef;
93 ret = bfelf_file_init(m_dummy_misc.get(), m_dummy_misc_length, &dummy_misc_ef);
95 ret = bfelf_file_init(m_dummy_code.get(), m_dummy_code_length, &dummy_code_ef);
98 auto &&dummy_misc_pair = get_elf_exec(&dummy_misc_ef);
99 auto &&dummy_code_pair = get_elf_exec(&dummy_code_ef);
101 m_dummy_misc_exec = std::move(std::get<0>(dummy_misc_pair));
102 m_dummy_code_exec = std::move(std::get<0>(dummy_code_pair));
104 bfelf_loader_t loader;
105 memset(&loader, 0,
sizeof(loader));
107 ret = bfelf_loader_add(&loader, &dummy_misc_ef, m_dummy_misc_exec.get(), m_dummy_misc_exec.get());
109 ret = bfelf_loader_add(&loader, &dummy_code_ef, m_dummy_code_exec.get(), m_dummy_code_exec.get());
112 ret = bfelf_loader_relocate(&loader);
117 ret = bfelf_file_get_section_info(&dummy_code_ef, &info);
131 bfelf_loader_ut::test_bfelf_file_get_section_info_init_fini()
134 bfelf_file_t dummy_misc_ef;
136 ret = bfelf_file_init(m_dummy_misc.get(), m_dummy_misc_length, &dummy_misc_ef);
139 dummy_misc_ef.init = 10;
140 dummy_misc_ef.fini = 10;
144 ret = bfelf_file_get_section_info(&dummy_misc_ef, &info);
void * memset(void *block, int c, size_t size)
#define BFELF_ERROR_INVALID_ARG