Skip to content

Commit

Permalink
Adjust normalization tests to compare file offsets
Browse files Browse the repository at this point in the history
Some of our normalization tests incorrectly compare the output of
normalization (file offsets) with a virtual address. Adjust them to
compare apples to apples (i.e., file offsets to file offsets) instead.

Refs: libbpf#835
Reported-by: Nicolas Savoire <nicolas.savoire@datadoghq.com>

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o authored and danielocfb committed Oct 3, 2024
1 parent c53b3bc commit 4d383c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/normalize/normalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ mod tests {
assert_eq!(normalized.meta.len(), 1);

let output = normalized.outputs[0];
assert_eq!(output.0, sym.addr);
assert_eq!(output.0, sym.file_offset.unwrap());
let meta = &normalized.meta[output.1];
let expected_elf = Elf {
build_id: Some(read_elf_build_id(&test_so).unwrap().unwrap()),
Expand Down Expand Up @@ -527,7 +527,7 @@ mod tests {
assert_eq!(normalized.meta.len(), 1);

let output = normalized.outputs[0];
assert_eq!(output.0, sym.addr);
assert_eq!(output.0, sym.file_offset.unwrap());
let meta = &normalized.meta[output.1].as_elf().unwrap();
let expected_build_id = if use_map_files || use_procmap_query {
Some(read_elf_build_id(&test_so).unwrap().unwrap())
Expand Down

0 comments on commit 4d383c1

Please sign in to comment.