mirror of
https://github.com/QuasarApp/ELFIO.git
synced 2025-05-01 14:19:34 +00:00
Move ELF test files to 'tests' directory
This commit is contained in:
parent
4f89bb0553
commit
de83f7dbbd
.gitignore
.vscode
tests
ELFIOTest.cppELFIOTest1.cpp
elf_examples
64bitLOAD.elfARMSCII-8.soarm_v7m_test_debug.elfarm_v7m_test_release.elfasmasm.lstasm.oasm.readelfasm.sasm64asm64.lstasm64.ocrash-060833f08dc14d1712428742b3cad7af17b36bb7crash-7d695153fd8052529d480c2352d4ada33a44badacrash-b82f05b0b25c8fdc98480e6d76b6d5f9164ae2bccrash-e1ce7cecf01cf800397a4302854d9d76fa19763ccrash-e3c41070342cf84dea077356ddbb8ebf4326a601crash.elfelf_header_i386_32.elfentropy.sohello.chello_32hello_32.ohello_32.txthello_32_o.txthello_64hello_64.ohello_64.txthello_64_o.txthello_armhello_arm.ohello_arm_strippedlibfunc.solibfunc32.solsls.readelfmainmain32ppc-32bit-specimen3.elfread_write_arm_elf32_inputstartup.elnstartup_orig.elntest_ppctest_ppc.cpptest_ppc.otest_ppc.txttest_ppc_o.txtwrite_exe_i386_32_matchwrite_exe_i386_32_work_dump.txtwrite_obj_i386_32_match.owrite_obj_i386_64_match.o
26
.gitignore
vendored
26
.gitignore
vendored
@ -31,19 +31,19 @@ examples/writer/writer.exe
|
|||||||
|
|
||||||
|
|
||||||
# generated elf files
|
# generated elf files
|
||||||
elf_examples/*_copy
|
tests/elf_examples/*_copy
|
||||||
elf_examples/*_copy.elf
|
tests/elf_examples/*_copy.elf
|
||||||
elf_examples/elf_dummy_header_i386_32.elf
|
tests/elf_examples/elf_dummy_header_i386_32.elf
|
||||||
elf_examples/elf_dummy_header_i386_64.elf
|
tests/elf_examples/elf_dummy_header_i386_64.elf
|
||||||
elf_examples/elf_dummy_header_ppc_32.elf
|
tests/elf_examples/elf_dummy_header_ppc_32.elf
|
||||||
elf_examples/elf_dummy_header_ppc_64.elf
|
tests/elf_examples/elf_dummy_header_ppc_64.elf
|
||||||
elf_examples/write_exe_i386_32
|
tests/elf_examples/write_exe_i386_32
|
||||||
elf_examples/write_exe_i386_32_w_addr
|
tests/elf_examples/write_exe_i386_32_w_addr
|
||||||
elf_examples/write_exe_i386_32_wo_addr
|
tests/elf_examples/write_exe_i386_32_wo_addr
|
||||||
elf_examples/write_exe_i386_32_section_added
|
tests/elf_examples/write_exe_i386_32_section_added
|
||||||
elf_examples/ppc-32bit-testcopy*.elf
|
tests/elf_examples/ppc-32bit-testcopy*.elf
|
||||||
elf_examples/null_section_inside_segment*
|
tests/elf_examples/null_section_inside_segment*
|
||||||
elf_examples/segment_containing_no_section*
|
tests/elf_examples/segment_containing_no_section*
|
||||||
|
|
||||||
# various unwanted files (backups, objects, cmake artifacts)
|
# various unwanted files (backups, objects, cmake artifacts)
|
||||||
*~
|
*~
|
||||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -30,7 +30,7 @@
|
|||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/examples/elfdump/elfdump",
|
"program": "${workspaceFolder}/examples/elfdump/elfdump",
|
||||||
"args": ["elf_examples/crash.elf"],
|
"args": ["tests/elf_examples/crash.elf"],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
|
@ -184,7 +184,7 @@ void
|
|||||||
BOOST_AUTO_TEST_CASE( load32 )
|
BOOST_AUTO_TEST_CASE( load32 )
|
||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/hello_32" ), true );
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/hello_32" ), true );
|
||||||
checkHeader( reader, ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ET_EXEC,
|
checkHeader( reader, ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ET_EXEC,
|
||||||
EM_386, 1, 0x80482b0, 0, 28, 7, 0, 0 );
|
EM_386, 1, 0x80482b0, 0, 28, 7, 0, 0 );
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE( load64 )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/hello_64" ), true );
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/hello_64" ), true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Check ELF header
|
// Check ELF header
|
||||||
@ -393,7 +393,7 @@ BOOST_AUTO_TEST_CASE( hello_64_o )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/hello_64.o" ), true );
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/hello_64.o" ), true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Check ELF header
|
// Check ELF header
|
||||||
@ -458,7 +458,7 @@ BOOST_AUTO_TEST_CASE( hello_32_o )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/hello_32.o" ), true );
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/hello_32.o" ), true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Check ELF header
|
// Check ELF header
|
||||||
@ -517,7 +517,7 @@ BOOST_AUTO_TEST_CASE( test_ppc_o )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/test_ppc.o" ), true );
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/test_ppc.o" ), true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Check ELF header
|
// Check ELF header
|
||||||
@ -594,7 +594,7 @@ BOOST_AUTO_TEST_CASE( test_ppc )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/test_ppc" ), true );
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/test_ppc" ), true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Check ELF header
|
// Check ELF header
|
||||||
@ -725,10 +725,10 @@ BOOST_AUTO_TEST_CASE( test_dummy_out_i386_32 )
|
|||||||
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
||||||
|
|
||||||
// Create ELF file
|
// Create ELF file
|
||||||
writer.save( "../elf_examples/elf_dummy_header_i386_32.elf" );
|
writer.save( "elf_examples/elf_dummy_header_i386_32.elf" );
|
||||||
|
|
||||||
elfio reader;
|
elfio reader;
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/elf_dummy_header_i386_32.elf" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/elf_dummy_header_i386_32.elf" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -781,10 +781,10 @@ BOOST_AUTO_TEST_CASE( test_dummy_out_ppc_32 )
|
|||||||
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
||||||
|
|
||||||
// Create ELF file
|
// Create ELF file
|
||||||
writer.save( "../elf_examples/elf_dummy_header_ppc_32.elf" );
|
writer.save( "elf_examples/elf_dummy_header_ppc_32.elf" );
|
||||||
|
|
||||||
elfio reader;
|
elfio reader;
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/elf_dummy_header_ppc_32.elf" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/elf_dummy_header_ppc_32.elf" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -837,10 +837,10 @@ BOOST_AUTO_TEST_CASE( test_dummy_out_i386_64 )
|
|||||||
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
||||||
|
|
||||||
// Create ELF file
|
// Create ELF file
|
||||||
writer.save( "../elf_examples/elf_dummy_header_i386_64.elf" );
|
writer.save( "elf_examples/elf_dummy_header_i386_64.elf" );
|
||||||
|
|
||||||
elfio reader;
|
elfio reader;
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/elf_dummy_header_i386_64.elf" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/elf_dummy_header_i386_64.elf" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -893,10 +893,10 @@ BOOST_AUTO_TEST_CASE( test_dummy_out_ppc_64 )
|
|||||||
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
BOOST_CHECK_EQUAL( note_sec->get_index(), 2 );
|
||||||
|
|
||||||
// Create ELF file
|
// Create ELF file
|
||||||
writer.save( "../elf_examples/elf_dummy_header_ppc_64.elf" );
|
writer.save( "elf_examples/elf_dummy_header_ppc_64.elf" );
|
||||||
|
|
||||||
elfio reader;
|
elfio reader;
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/elf_dummy_header_ppc_64.elf" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/elf_dummy_header_ppc_64.elf" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -927,7 +927,7 @@ BOOST_AUTO_TEST_CASE( test_dynamic_64_1 )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/main" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/main" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
section* dynsec = reader.sections[".dynamic"];
|
section* dynsec = reader.sections[".dynamic"];
|
||||||
@ -963,7 +963,7 @@ BOOST_AUTO_TEST_CASE( test_dynamic_64_2 )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/libfunc.so" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/libfunc.so" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
section* dynsec = reader.sections[".dynamic"];
|
section* dynsec = reader.sections[".dynamic"];
|
||||||
@ -996,7 +996,7 @@ BOOST_AUTO_TEST_CASE( test_dynamic_64_3 )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( reader.load( "../elf_examples/main" ),
|
BOOST_REQUIRE_EQUAL( reader.load( "elf_examples/main" ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
section* dynsec = reader.sections[".dynamic"];
|
section* dynsec = reader.sections[".dynamic"];
|
||||||
|
@ -104,8 +104,8 @@ bool write_obj_i386( bool is64bit )
|
|||||||
// Create ELF file
|
// Create ELF file
|
||||||
writer.save(
|
writer.save(
|
||||||
is64bit ?
|
is64bit ?
|
||||||
"../elf_examples/write_obj_i386_64.o" :
|
"elf_examples/write_obj_i386_64.o" :
|
||||||
"../elf_examples/write_obj_i386_32.o"
|
"elf_examples/write_obj_i386_32.o"
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -116,8 +116,8 @@ bool write_obj_i386( bool is64bit )
|
|||||||
BOOST_AUTO_TEST_CASE( write_obj_i386_32 )
|
BOOST_AUTO_TEST_CASE( write_obj_i386_32 )
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL( true, write_obj_i386( false ) );
|
BOOST_CHECK_EQUAL( true, write_obj_i386( false ) );
|
||||||
output_test_stream output( "../elf_examples/write_obj_i386_32_match.o", true, false );
|
output_test_stream output( "elf_examples/write_obj_i386_32_match.o", true, false );
|
||||||
std::ifstream input( "../elf_examples/write_obj_i386_32.o", std::ios::binary );
|
std::ifstream input( "elf_examples/write_obj_i386_32.o", std::ios::binary );
|
||||||
output << input.rdbuf();
|
output << input.rdbuf();
|
||||||
BOOST_CHECK( output.match_pattern() );
|
BOOST_CHECK( output.match_pattern() );
|
||||||
}
|
}
|
||||||
@ -127,8 +127,8 @@ BOOST_AUTO_TEST_CASE( write_obj_i386_32 )
|
|||||||
BOOST_AUTO_TEST_CASE( write_obj_i386_64 )
|
BOOST_AUTO_TEST_CASE( write_obj_i386_64 )
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL( true, write_obj_i386( true ) );
|
BOOST_CHECK_EQUAL( true, write_obj_i386( true ) );
|
||||||
output_test_stream output( "../elf_examples/write_obj_i386_64_match.o", true, false );
|
output_test_stream output( "elf_examples/write_obj_i386_64_match.o", true, false );
|
||||||
std::ifstream input( "../elf_examples/write_obj_i386_64.o", std::ios::binary );
|
std::ifstream input( "elf_examples/write_obj_i386_64.o", std::ios::binary );
|
||||||
output << input.rdbuf();
|
output << input.rdbuf();
|
||||||
BOOST_CHECK( output.match_pattern() );
|
BOOST_CHECK( output.match_pattern() );
|
||||||
}
|
}
|
||||||
@ -210,8 +210,8 @@ bool write_exe_i386( const std::string& filename, bool is64bit, bool set_addr =
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
BOOST_AUTO_TEST_CASE( write_exe_i386_32 )
|
BOOST_AUTO_TEST_CASE( write_exe_i386_32 )
|
||||||
{
|
{
|
||||||
const std::string generated_file ( "../elf_examples/write_exe_i386_32" );
|
const std::string generated_file ( "elf_examples/write_exe_i386_32" );
|
||||||
const std::string reference_file ( "../elf_examples/write_exe_i386_32_match" );
|
const std::string reference_file ( "elf_examples/write_exe_i386_32_match" );
|
||||||
BOOST_CHECK_EQUAL( true, write_exe_i386( generated_file, false ) );
|
BOOST_CHECK_EQUAL( true, write_exe_i386( generated_file, false ) );
|
||||||
output_test_stream output( reference_file, true, false );
|
output_test_stream output( reference_file, true, false );
|
||||||
std::ifstream input( generated_file, std::ios::binary );
|
std::ifstream input( generated_file, std::ios::binary );
|
||||||
@ -332,16 +332,16 @@ void checkExeAreEqual( std::string file_name1, std::string file_name2, int skipT
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
BOOST_AUTO_TEST_CASE( elf_object_copy_32 )
|
BOOST_AUTO_TEST_CASE( elf_object_copy_32 )
|
||||||
{
|
{
|
||||||
checkObjestsAreEqual( "../elf_examples/hello_32.o",
|
checkObjestsAreEqual( "elf_examples/hello_32.o",
|
||||||
"../elf_examples/hello_32_copy.o" );
|
"elf_examples/hello_32_copy.o" );
|
||||||
checkObjestsAreEqual( "../elf_examples/hello_64.o",
|
checkObjestsAreEqual( "elf_examples/hello_64.o",
|
||||||
"../elf_examples/hello_64_copy.o" );
|
"elf_examples/hello_64_copy.o" );
|
||||||
checkObjestsAreEqual( "../elf_examples/test_ppc.o",
|
checkObjestsAreEqual( "elf_examples/test_ppc.o",
|
||||||
"../elf_examples/test_ppc_copy.o" );
|
"elf_examples/test_ppc_copy.o" );
|
||||||
checkObjestsAreEqual( "../elf_examples/write_obj_i386_32.o",
|
checkObjestsAreEqual( "elf_examples/write_obj_i386_32.o",
|
||||||
"../elf_examples/write_obj_i386_32_copy.o" );
|
"elf_examples/write_obj_i386_32_copy.o" );
|
||||||
checkObjestsAreEqual( "../elf_examples/write_obj_i386_64.o",
|
checkObjestsAreEqual( "elf_examples/write_obj_i386_64.o",
|
||||||
"../elf_examples/write_obj_i386_64_copy.o" );
|
"elf_examples/write_obj_i386_64_copy.o" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ BOOST_AUTO_TEST_CASE( section_header_address_update )
|
|||||||
{
|
{
|
||||||
elfio reader;
|
elfio reader;
|
||||||
|
|
||||||
const std::string file_w_addr ( "../elf_examples/write_exe_i386_32_w_addr" );
|
const std::string file_w_addr ( "elf_examples/write_exe_i386_32_w_addr" );
|
||||||
write_exe_i386( file_w_addr, false, true, 0x08048100 );
|
write_exe_i386( file_w_addr, false, true, 0x08048100 );
|
||||||
reader.load( file_w_addr );
|
reader.load( file_w_addr );
|
||||||
section* sec = reader.sections[".text"];
|
section* sec = reader.sections[".text"];
|
||||||
@ -358,7 +358,7 @@ BOOST_AUTO_TEST_CASE( section_header_address_update )
|
|||||||
BOOST_CHECK_EQUAL( sec->get_address(), 0x08048100 );
|
BOOST_CHECK_EQUAL( sec->get_address(), 0x08048100 );
|
||||||
|
|
||||||
|
|
||||||
const std::string file_wo_addr ( "../elf_examples/write_exe_i386_32_wo_addr" );
|
const std::string file_wo_addr ( "elf_examples/write_exe_i386_32_wo_addr" );
|
||||||
write_exe_i386( file_wo_addr, false, false, 0 );
|
write_exe_i386( file_wo_addr, false, false, 0 );
|
||||||
reader.load( file_wo_addr );
|
reader.load( file_wo_addr );
|
||||||
sec = reader.sections[".text"];
|
sec = reader.sections[".text"];
|
||||||
@ -372,7 +372,7 @@ BOOST_AUTO_TEST_CASE( elfio_copy )
|
|||||||
{
|
{
|
||||||
elfio e;
|
elfio e;
|
||||||
|
|
||||||
const std::string filename ( "../elf_examples/write_exe_i386_32_section_added" );
|
const std::string filename ( "elf_examples/write_exe_i386_32_section_added" );
|
||||||
write_exe_i386( filename, false, true, 0x08048100 );
|
write_exe_i386( filename, false, true, 0x08048100 );
|
||||||
|
|
||||||
e.load( filename );
|
e.load( filename );
|
||||||
@ -386,48 +386,48 @@ BOOST_AUTO_TEST_CASE( elfio_copy )
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
BOOST_AUTO_TEST_CASE( elf_exe_copy_64 )
|
BOOST_AUTO_TEST_CASE( elf_exe_copy_64 )
|
||||||
{
|
{
|
||||||
checkExeAreEqual( "../elf_examples/64bitLOAD.elf",
|
checkExeAreEqual( "elf_examples/64bitLOAD.elf",
|
||||||
"../elf_examples/64bitLOAD_copy.elf" );
|
"elf_examples/64bitLOAD_copy.elf" );
|
||||||
checkExeAreEqual( "../elf_examples/asm64",
|
checkExeAreEqual( "elf_examples/asm64",
|
||||||
"../elf_examples/asm64_copy" );
|
"elf_examples/asm64_copy" );
|
||||||
checkExeAreEqual( "../elf_examples/hello_64",
|
checkExeAreEqual( "elf_examples/hello_64",
|
||||||
"../elf_examples/hello_64_copy" );
|
"elf_examples/hello_64_copy" );
|
||||||
|
|
||||||
// The last segment (GNU_RELRO) is bigger than necessary.
|
// The last segment (GNU_RELRO) is bigger than necessary.
|
||||||
// I don't see why but it contains a few bits of the .got.plt section.
|
// I don't see why but it contains a few bits of the .got.plt section.
|
||||||
// -> load, store, compare cycle fails
|
// -> load, store, compare cycle fails
|
||||||
// checkExeAreEqual( "../elf_examples/main",
|
// checkExeAreEqual( "elf_examples/main",
|
||||||
// "../elf_examples/main_copy" );
|
// "elf_examples/main_copy" );
|
||||||
// checkExeAreEqual( "../elf_examples/ls",
|
// checkExeAreEqual( "elf_examples/ls",
|
||||||
// "../elf_examples/ls_copy" );
|
// "elf_examples/ls_copy" );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
BOOST_AUTO_TEST_CASE( elf_exe_copy_32 )
|
BOOST_AUTO_TEST_CASE( elf_exe_copy_32 )
|
||||||
{
|
{
|
||||||
checkExeAreEqual( "../elf_examples/asm",
|
checkExeAreEqual( "elf_examples/asm",
|
||||||
"../elf_examples/asm_copy" );
|
"elf_examples/asm_copy" );
|
||||||
checkExeAreEqual( "../elf_examples/arm_v7m_test_debug.elf",
|
checkExeAreEqual( "elf_examples/arm_v7m_test_debug.elf",
|
||||||
"../elf_examples/arm_v7m_test_debug_copy.elf" );
|
"elf_examples/arm_v7m_test_debug_copy.elf" );
|
||||||
checkExeAreEqual( "../elf_examples/arm_v7m_test_release.elf",
|
checkExeAreEqual( "elf_examples/arm_v7m_test_release.elf",
|
||||||
"../elf_examples/arm_v7m_test_release_copy.elf" );
|
"elf_examples/arm_v7m_test_release_copy.elf" );
|
||||||
checkExeAreEqual( "../elf_examples/hello_32",
|
checkExeAreEqual( "elf_examples/hello_32",
|
||||||
"../elf_examples/hello_32_copy" );
|
"elf_examples/hello_32_copy" );
|
||||||
checkExeAreEqual( "../elf_examples/hello_arm",
|
checkExeAreEqual( "elf_examples/hello_arm",
|
||||||
"../elf_examples/hello_arm_copy" );
|
"elf_examples/hello_arm_copy" );
|
||||||
checkExeAreEqual( "../elf_examples/hello_arm_stripped",
|
checkExeAreEqual( "elf_examples/hello_arm_stripped",
|
||||||
"../elf_examples/hello_arm_stripped_copy" );
|
"elf_examples/hello_arm_stripped_copy" );
|
||||||
checkExeAreEqual( "../elf_examples/read_write_arm_elf32_input",
|
checkExeAreEqual( "elf_examples/read_write_arm_elf32_input",
|
||||||
"../elf_examples/read_write_arm_elf32_input_copy" );
|
"elf_examples/read_write_arm_elf32_input_copy" );
|
||||||
checkExeAreEqual( "../elf_examples/test_ppc",
|
checkExeAreEqual( "elf_examples/test_ppc",
|
||||||
"../elf_examples/test_ppc_copy" );
|
"elf_examples/test_ppc_copy" );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
BOOST_AUTO_TEST_CASE( elf_exe_loadsave_ppc32big3 )
|
BOOST_AUTO_TEST_CASE( elf_exe_loadsave_ppc32big3 )
|
||||||
{
|
{
|
||||||
std::string in = "../elf_examples/ppc-32bit-specimen3.elf";
|
std::string in = "elf_examples/ppc-32bit-specimen3.elf";
|
||||||
std::string out = "../elf_examples/ppc-32bit-testcopy3.elf";
|
std::string out = "elf_examples/ppc-32bit-testcopy3.elf";
|
||||||
elfio elf;
|
elfio elf;
|
||||||
BOOST_REQUIRE_EQUAL( elf.load( in ), true );
|
BOOST_REQUIRE_EQUAL( elf.load( in ), true );
|
||||||
BOOST_REQUIRE_EQUAL( elf.save( out ), true );
|
BOOST_REQUIRE_EQUAL( elf.save( out ), true );
|
||||||
@ -446,7 +446,7 @@ BOOST_AUTO_TEST_CASE( get_symbol_32 )
|
|||||||
unsigned char type;
|
unsigned char type;
|
||||||
ELFIO::Elf_Half section_index;
|
ELFIO::Elf_Half section_index;
|
||||||
unsigned char other;
|
unsigned char other;
|
||||||
std::string in = "../elf_examples/hello_32";
|
std::string in = "elf_examples/hello_32";
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( elf.load(in), true );
|
BOOST_REQUIRE_EQUAL( elf.load(in), true );
|
||||||
section* psymsec = elf.sections[ ".symtab" ];
|
section* psymsec = elf.sections[ ".symtab" ];
|
||||||
@ -470,7 +470,7 @@ BOOST_AUTO_TEST_CASE( get_symbol_64 )
|
|||||||
unsigned char type;
|
unsigned char type;
|
||||||
ELFIO::Elf_Half section_index;
|
ELFIO::Elf_Half section_index;
|
||||||
unsigned char other;
|
unsigned char other;
|
||||||
std::string in = "../elf_examples/hello_64";
|
std::string in = "elf_examples/hello_64";
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( elf.load(in), true );
|
BOOST_REQUIRE_EQUAL( elf.load(in), true );
|
||||||
section* psymsec = elf.sections[ ".symtab" ];
|
section* psymsec = elf.sections[ ".symtab" ];
|
||||||
@ -491,7 +491,7 @@ BOOST_AUTO_TEST_CASE( null_section_inside_segment )
|
|||||||
// See https://github.com/serge1/ELFIO/issues/19
|
// See https://github.com/serge1/ELFIO/issues/19
|
||||||
//
|
//
|
||||||
// Note: The test case checking the load/save of a segment containing no section
|
// Note: The test case checking the load/save of a segment containing no section
|
||||||
// is covered by elf_object_copy_32: ../elf_examples/hello_32 has empty segments
|
// is covered by elf_object_copy_32: elf_examples/hello_32 has empty segments
|
||||||
|
|
||||||
// Create an ELF file with SHT_NULL sections at the beginning/middle/end of a segment
|
// Create an ELF file with SHT_NULL sections at the beginning/middle/end of a segment
|
||||||
elfio writer;
|
elfio writer;
|
||||||
@ -543,8 +543,8 @@ BOOST_AUTO_TEST_CASE( null_section_inside_segment )
|
|||||||
// Setup entry point
|
// Setup entry point
|
||||||
writer.set_entry( 0x08048000 );
|
writer.set_entry( 0x08048000 );
|
||||||
// Create ELF file
|
// Create ELF file
|
||||||
std::string f1 = "../elf_examples/null_section_inside_segment1";
|
std::string f1 = "elf_examples/null_section_inside_segment1";
|
||||||
std::string f2 = "../elf_examples/null_section_inside_segment2";
|
std::string f2 = "elf_examples/null_section_inside_segment2";
|
||||||
BOOST_CHECK_EQUAL( writer.save(f1), true );
|
BOOST_CHECK_EQUAL( writer.save(f1), true );
|
||||||
|
|
||||||
// Load and check the ELF file created above
|
// Load and check the ELF file created above
|
||||||
@ -564,7 +564,7 @@ BOOST_AUTO_TEST_CASE(invalid_file)
|
|||||||
unsigned char type;
|
unsigned char type;
|
||||||
ELFIO::Elf_Half section_index;
|
ELFIO::Elf_Half section_index;
|
||||||
unsigned char other;
|
unsigned char other;
|
||||||
std::string in = "../elf_examples/crash.elf";
|
std::string in = "elf_examples/crash.elf";
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL(elf.load(in), true);
|
BOOST_REQUIRE_EQUAL(elf.load(in), true);
|
||||||
section *psymsec = elf.sections[".symtab"];
|
section *psymsec = elf.sections[".symtab"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user