diff options
| author | Mark Wielaard <mark@klomp.org> | 2025-06-27 14:24:20 +0200 |
|---|---|---|
| committer | Mark Wielaard <mark@klomp.org> | 2025-06-27 14:24:40 +0200 |
| commit | 468ff08295bc3b7926176c12f01b49891674c132 (patch) | |
| tree | b09cb6f646e6cce27829da3249a2030d5343a772 | |
| parent | Add 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.at | 4 |
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 |
| 892 | echo "int main () { }" > main.c | 892 | echo "int main () { }" > main.c |
| 893 | $CC $CFLAGS -Wl,--build-id -o main main.c | 893 | $CC $CFLAGS -Wl,--build-id -o main main.c |
| 894 | AT_CHECK([[$READELF -n main | grep Build.ID: | awk '{print $3}']], [0], [stdout], [ignore]) | 894 | AT_CHECK([[$READELF -n main | grep -o "Build.ID:.*" | awk '{print $3}']], [0], [stdout], [ignore]) |
| 895 | bid="`cat stdout`" | 895 | bid="`cat stdout`" |
| 896 | AT_CHECK([[expr "$bid" : '[0-9a-f]*']], [0], [ignore]) | 896 | AT_CHECK([[expr "$bid" : '[0-9a-f]*']], [0], [ignore]) |
| 897 | 897 | ||
| @@ -902,7 +902,7 @@ AT_CHECK([[expr "$bid2a" : '[0-9a-f]*']], [0], [ignore]) | |||
| 902 | AT_CHECK([[test "$bid" != "$bid2a"]]) | 902 | AT_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 |
| 905 | AT_CHECK([[$READELF -n main | grep Build.ID: | awk '{print $3}']], [0], [stdout], [ignore]) | 905 | AT_CHECK([[$READELF -n main | grep -o "Build.ID:.*" | awk '{print $3}']], [0], [stdout], [ignore]) |
| 906 | bid2b="`cat stdout`" | 906 | bid2b="`cat stdout`" |
| 907 | AT_CHECK([[expr "$bid2b" : '[0-9a-f]*']], [0], [ignore]) | 907 | AT_CHECK([[expr "$bid2b" : '[0-9a-f]*']], [0], [ignore]) |
| 908 | AT_CHECK([[test "$bid2a" = "$bid2b"]]) | 908 | AT_CHECK([[test "$bid2a" = "$bid2b"]]) |
