SHA256
1
0
forked from pool/dwz

Accepting request 861040 from home:tomdevries:branches:devel:tools:compiler-dwz-fix-testcases

- Fix pr24468.sh test-case with newer readelf.
  * dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch
  * dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch
- Detect when devel-ignore-size.sh is unsupported [swo#27115].
  * dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch

OBS-URL: https://build.opensuse.org/request/show/861040
OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=32
This commit is contained in:
Martin Pluskal 2021-01-12 08:40:04 +00:00 committed by Git OBS Bridge
parent a5eda5672f
commit fe44ecf795
5 changed files with 138 additions and 1 deletions

View File

@ -0,0 +1,29 @@
Adjust pr24468.sh test-case for readelf with =follow-links.
Newer binutils readelf have =follow-links which is automatically
enabled with -w. This shows not only the debuginfo of the main file
but also that of the alt file referenced. This causes the pr24468.sh
to see "too many" DW_TAG_partial_units (from both files) which then
doesn't matches the number of DW_AT_imports. The fix is simply to
use -wi instead of -w since we are only interested in the .debug_info
DIEs anyway.
* testsuite/dwz.tests/pr24468.sh: Use readelf -wi.
---
testsuite/dwz.tests/pr24468.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/dwz.tests/pr24468.sh b/testsuite/dwz.tests/pr24468.sh
index b03fdf9..4dac9a1 100644
--- a/testsuite/dwz.tests/pr24468.sh
+++ b/testsuite/dwz.tests/pr24468.sh
@@ -5,7 +5,7 @@ cp 1 2
dwz -m 3 1 2
-readelf -w 1 > READELF 2>/dev/null
+readelf -wi 1 > READELF 2>/dev/null
offsets=$(grep '(DW_TAG_partial_unit' READELF \
| awk '{print $1}' \

View File

@ -0,0 +1,39 @@
[testsuite] Detect when devel-ignore-size.sh is unsupported
In PR27115, a failure of devel-ignore-size.sh is reported.
The test-case:
- tries to transform an executable
- checks that it didn't transform
- retries using --devel-ignore-size
- check that it did transform
The reported failure is in the second step.
Fix this by marking the test unsupported if the second step fails.
2021-01-04 Tom de Vries <tdevries@suse.de>
PR dwz/27115
* testsuite/dwz.tests/devel-ignore-size.sh: If exec is transformed
without --devel-ignore-size, mark unsupported.
---
testsuite/dwz.tests/devel-ignore-size.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/testsuite/dwz.tests/devel-ignore-size.sh b/testsuite/dwz.tests/devel-ignore-size.sh
index 5134043..78d28a2 100644
--- a/testsuite/dwz.tests/devel-ignore-size.sh
+++ b/testsuite/dwz.tests/devel-ignore-size.sh
@@ -12,7 +12,9 @@ cnt=$(readelf -wi 1 \
| grep '(DW_TAG_partial_unit' \
| wc -l)
-[ $cnt -eq 0 ]
+if [ $cnt -ne 0 ]; then
+ exit 77
+fi
cp $execs/min 1

View File

@ -0,0 +1,50 @@
[testsuite] Fix partial unit grepping in pr24468.sh
I'm running into:
...
FAIL: src/testsuite/dwz.tests/pr24468.sh
...
In more detail, we find the following offsets for partial units:
...
+ offsets='b
6b
da'
...
and then fail to find an import for the one at 6b:
...
++ grep -c 'DW_AT_import.*0x6b' READELF
++ true
+ imports=0
+ '[' 0 -gt 0 ']'
...
But there's actually no partial unit at 6b, the grep matches on a
DW_AT_import:
...
<6b> DW_AT_import : <0xb> [Abbrev Number: 17 (DW_TAG_partial_unit)]
...
Fix this by filtering out the DW_AT_import lines when grepping for partial
units.
2020-12-20 Tom de Vries <tdevries@suse.de>
* testsuite/dwz.tests/pr24468.sh: Fix partial unit grepping.
---
testsuite/dwz.tests/pr24468.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/testsuite/dwz.tests/pr24468.sh b/testsuite/dwz.tests/pr24468.sh
index 4dac9a1..7990e83 100644
--- a/testsuite/dwz.tests/pr24468.sh
+++ b/testsuite/dwz.tests/pr24468.sh
@@ -8,6 +8,7 @@ dwz -m 3 1 2
readelf -wi 1 > READELF 2>/dev/null
offsets=$(grep '(DW_TAG_partial_unit' READELF \
+ | grep -v "DW_AT_import" \
| awk '{print $1}' \
| sed 's/.*<//;s/>.*//')
for off in $offsets; do

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Jan 7 10:21:31 UTC 2021 - Tom de Vries <tdevries@suse.com>
- Fix pr24468.sh test-case with newer readelf.
* dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch
* dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch
-------------------------------------------------------------------
Thu Jan 7 09:15:48 UTC 2021 - Tom de Vries <tdevries@suse.com>
- Detect when devel-ignore-size.sh is unsupported [swo#27115].
* dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch
-------------------------------------------------------------------
Wed Aug 5 08:16:04 UTC 2020 - Tom de Vries <tdevries@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package dwz
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -85,6 +85,9 @@ Patch3: dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch
Patch4: dwz-fix-refd-NULL-assertion-in-write_die.patch
Patch5: dwz-fix-reference-from-pu-to-cu.patch
Patch6: dwz-fix-segfault-in-die_cu.patch
Patch7: dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch
Patch8: dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch
Patch9: dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch
%if %{build_main}
%description
@ -119,6 +122,9 @@ This package contains the testsuite results from DWZ.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
make %{?_smp_mflags} CFLAGS="%{optflags}"