Rename sample object files used in tests to be more descriptive
This commit is contained in:
parent
73a847719f
commit
7672d5cf93
2
sample-objects/symver.sh
Normal file
2
sample-objects/symver.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
gcc -o symver.x86_64.so symver.c -Wl,--as-needed -shared -fPIC -Xlinker --hash-style=both -Wl,--version-script=symver.ver
|
@ -38,7 +38,7 @@ use crate::symbol::{Symbol, SymbolTable};
|
||||
/// use elf::ElfBytes;
|
||||
/// use elf::segment::ProgramHeader;
|
||||
///
|
||||
/// let path = std::path::PathBuf::from("tests/samples/hello.so");
|
||||
/// let path = std::path::PathBuf::from("sample-objects/symver.x86_64.so");
|
||||
/// let file_data = std::fs::read(path).unwrap();
|
||||
///
|
||||
/// let slice = file_data.as_slice();
|
||||
@ -201,7 +201,7 @@ impl<'data, E: EndianParse> ElfBytes<'data, E> {
|
||||
/// use elf::ElfBytes;
|
||||
/// use elf::section::SectionHeader;
|
||||
///
|
||||
/// let path = std::path::PathBuf::from("tests/samples/hello.so");
|
||||
/// let path = std::path::PathBuf::from("sample-objects/symver.x86_64.so");
|
||||
/// let file_data = std::fs::read(path).unwrap();
|
||||
///
|
||||
/// let slice = file_data.as_slice();
|
||||
@ -261,7 +261,7 @@ impl<'data, E: EndianParse> ElfBytes<'data, E> {
|
||||
/// use elf::note::Note;
|
||||
/// use elf::note::NoteGnuAbiTag;
|
||||
///
|
||||
/// let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
/// let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
/// let file_data = std::fs::read(path).unwrap();
|
||||
/// let slice = file_data.as_slice();
|
||||
/// let file = ElfBytes::<AnyEndian>::minimal_parse(slice).unwrap();
|
||||
@ -793,7 +793,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn simultaenous_segments_parsing() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -834,7 +834,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn segments() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -861,7 +861,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_headers() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -877,7 +877,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_headers_with_strtab() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -906,7 +906,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_header_by_name() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -927,7 +927,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn find_common_sections() {
|
||||
let path = std::path::PathBuf::from("tests/samples/hello.so");
|
||||
let path = std::path::PathBuf::from("sample-objects/symver.x86_64.so");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -945,7 +945,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -969,7 +969,7 @@ mod interface_tests {
|
||||
// Test all the different section_data_as* with a section of the wrong type
|
||||
#[test]
|
||||
fn section_data_as_wrong_type() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1019,7 +1019,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_strtab() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1042,7 +1042,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_relas() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1079,7 +1079,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_notes() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1107,7 +1107,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn segment_data_as_notes() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1142,7 +1142,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn dynamic() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1170,7 +1170,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn symbol_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1201,7 +1201,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn dynamic_symbol_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1232,7 +1232,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn symbol_version_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
@ -1264,7 +1264,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn sysv_hash_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/hello.so");
|
||||
let path = std::path::PathBuf::from("sample-objects/symver.x86_64.so");
|
||||
let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
let slice = file_data.as_slice();
|
||||
let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
|
@ -184,7 +184,7 @@ impl<E: EndianParse, S: std::io::Read + std::io::Seek> ElfStream<E, S> {
|
||||
/// use elf::note::Note;
|
||||
/// use elf::note::NoteGnuAbiTag;
|
||||
///
|
||||
/// let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
/// let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
/// let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
/// let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -665,7 +665,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn test_open_stream() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
assert_eq!(file.ehdr.e_type, abi::ET_EXEC);
|
||||
@ -673,7 +673,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_headers_with_strtab() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -692,7 +692,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_header_by_name() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -712,7 +712,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_for_nobits() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -727,7 +727,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -742,7 +742,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_strtab() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -758,7 +758,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn segments() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -785,7 +785,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn symbol_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -815,7 +815,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn dynamic_symbol_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -845,7 +845,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn dynamic_section() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -871,7 +871,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_rels() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -882,7 +882,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_relas() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -913,7 +913,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn section_data_as_notes() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -935,7 +935,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn segment_data_as_notes() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
@ -969,7 +969,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn symbol_version_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
let vst = file
|
||||
@ -999,7 +999,7 @@ mod interface_tests {
|
||||
|
||||
#[test]
|
||||
fn sysv_hash_table() {
|
||||
let path = std::path::PathBuf::from("tests/samples/hello.so");
|
||||
let path = std::path::PathBuf::from("sample-objects/symver.x86_64.so");
|
||||
let io = std::fs::File::open(path).expect("Could not open file.");
|
||||
let mut file = ElfStream::<AnyEndian, _>::open_stream(io).expect("Open test1");
|
||||
|
||||
|
@ -92,7 +92,7 @@
|
||||
//! use elf::note::NoteGnuBuildId;
|
||||
//! use elf::section::SectionHeader;
|
||||
//!
|
||||
//! let path = std::path::PathBuf::from("tests/samples/hello.so");
|
||||
//! let path = std::path::PathBuf::from("sample-objects/symver.x86_64.so");
|
||||
//! let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
//! let slice = file_data.as_slice();
|
||||
//! let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
|
@ -7,7 +7,7 @@
|
||||
//! use elf::note::Note;
|
||||
//! use elf::note::NoteGnuAbiTag;
|
||||
//!
|
||||
//! let path = std::path::PathBuf::from("tests/samples/test1");
|
||||
//! let path = std::path::PathBuf::from("sample-objects/basic.x86_64");
|
||||
//! let file_data = std::fs::read(path).expect("Could not read file.");
|
||||
//! let slice = file_data.as_slice();
|
||||
//! let file = ElfBytes::<AnyEndian>::minimal_parse(slice).expect("Open test1");
|
||||
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
gcc -o hello.so hello.c -Wl,--as-needed -shared -fPIC -Xlinker --hash-style=both -Wl,--version-script=hello.ver
|
Loading…
x
Reference in New Issue
Block a user