summaryrefslogtreecommitdiffstats
diff options
authorMark Wielaard <mark@klomp.org>2025-06-27 14:24:20 +0200
committerMark Wielaard <mark@klomp.org>2025-06-27 14:24:40 +0200
commit468ff08295bc3b7926176c12f01b49891674c132 (patch)
treeb09cb6f646e6cce27829da3249a2030d5343a772
parentAdd basic find-debuginfo script tests (diff)
debugedit.at: Deal with readelf with --wide default for buildid matching
We binutils readelf defaults to --wide it joins some lines when printing ELF notes. This means the grep and awk to extract a buildid don't work because the field numbers don't match up. Use grep -o to only print out the matching (end) of the Build ID: line. https://sourceware.org/bugzilla/show_bug.cgi?id=33110 Suggested-by: Vitaly Chikunov <vt@altlinux.org> Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--tests/debugedit.at4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/debugedit.at b/tests/debugedit.at
index 21b67a6..2758683 100644
--- a/tests/debugedit.at
+++ b/tests/debugedit.at
@@ -891,7 +891,7 @@ AT_KEYWORDS([debuginfo] [debugedit] [build-id])
891# compile a test program and extract its linker-assigned build-id 891# compile a test program and extract its linker-assigned build-id
892echo "int main () { }" > main.c 892echo "int main () { }" > main.c
893$CC $CFLAGS -Wl,--build-id -o main main.c 893$CC $CFLAGS -Wl,--build-id -o main main.c
894AT_CHECK([[$READELF -n main | grep Build.ID: | awk '{print $3}']], [0], [stdout], [ignore]) 894AT_CHECK([[$READELF -n main | grep -o "Build.ID:.*" | awk '{print $3}']], [0], [stdout], [ignore])
895bid="`cat stdout`" 895bid="`cat stdout`"
896AT_CHECK([[expr "$bid" : '[0-9a-f]*']], [0], [ignore]) 896AT_CHECK([[expr "$bid" : '[0-9a-f]*']], [0], [ignore])
897 897
@@ -902,7 +902,7 @@ AT_CHECK([[expr "$bid2a" : '[0-9a-f]*']], [0], [ignore])
902AT_CHECK([[test "$bid" != "$bid2a"]]) 902AT_CHECK([[test "$bid" != "$bid2a"]])
903 903
904# check that debugedit's stdout matches readelf -n note 904# check that debugedit's stdout matches readelf -n note
905AT_CHECK([[$READELF -n main | grep Build.ID: | awk '{print $3}']], [0], [stdout], [ignore]) 905AT_CHECK([[$READELF -n main | grep -o "Build.ID:.*" | awk '{print $3}']], [0], [stdout], [ignore])
906bid2b="`cat stdout`" 906bid2b="`cat stdout`"
907AT_CHECK([[expr "$bid2b" : '[0-9a-f]*']], [0], [ignore]) 907AT_CHECK([[expr "$bid2b" : '[0-9a-f]*']], [0], [ignore])
908AT_CHECK([[test "$bid2a" = "$bid2b"]]) 908AT_CHECK([[test "$bid2a" = "$bid2b"]])