public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed][testsuite] Fix odr tests with clang
@ 2021-02-16 11:11 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-02-16 11:11 UTC (permalink / raw)
  To: dwz, jakub, mark

Hi,

When running the testsuite with clang, I run into:
...
$ make check CC=clang CXX=clang++
  ...
FAIL: testsuite/dwz.tests/odr-def-decl.sh
FAIL: testsuite/dwz.tests/odr-loc.sh
FAIL: testsuite/dwz.tests/odr-struct-ns.sh
FAIL: testsuite/dwz.tests/odr-struct.sh
...

The problem is that clang emits less DIEs.  For this bit from odr-loc.cc:
...
struct bbb;
struct ccc {
  int member_three;
};

struct aaa
{
  struct bbb *member_one;
  struct ccc *member_two;
};

struct aaa var1;
...
it ignores the definition of struct ccc, and therefore only has a
DW_AT_declaration DIE for ccc.

Fix this by adding variables for the type definitions that are ignored by
clang.

Committed to trunk.

Thanks,
- Tom

[testsuite] Fix odr tests with clang

2021-02-16  Tom de Vries  <tdevries@suse.de>

	* testsuite/dwz.tests/def2.c (foo): New function.  Allocate ao_ref.
	* testsuite/dwz.tests/odr-def-decl.sh: Update expected counts.
	* testsuite/dwz.tests/odr-2.cc: Add var.
	* testsuite/dwz.tests/odr-loc-2.cc: Same.
	* testsuite/dwz.tests/odr-loc.cc:  Same.
	* testsuite/dwz.tests/odr.cc: Same.

---
 testsuite/dwz.tests/def2.c          | 6 ++++++
 testsuite/dwz.tests/odr-2.cc        | 2 ++
 testsuite/dwz.tests/odr-def-decl.sh | 4 ++--
 testsuite/dwz.tests/odr-loc-2.cc    | 1 +
 testsuite/dwz.tests/odr-loc.cc      | 1 +
 testsuite/dwz.tests/odr.cc          | 2 ++
 6 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/testsuite/dwz.tests/def2.c b/testsuite/dwz.tests/def2.c
index c1eacf3..794933f 100644
--- a/testsuite/dwz.tests/def2.c
+++ b/testsuite/dwz.tests/def2.c
@@ -1,3 +1,9 @@
 #include "def.h"
 
 ao_ref *p2;
+
+void
+foo (void)
+{
+  p2 = new ao_ref;
+}
diff --git a/testsuite/dwz.tests/odr-2.cc b/testsuite/dwz.tests/odr-2.cc
index fd033da..8b3dcd2 100644
--- a/testsuite/dwz.tests/odr-2.cc
+++ b/testsuite/dwz.tests/odr-2.cc
@@ -13,6 +13,8 @@ namespace ns {
 
 #if NAMESPACE
 KIND ns::aaa var2;
+KIND ns::bbb var4;
 #else
 KIND aaa var2;
+KIND bbb var4;
 #endif
diff --git a/testsuite/dwz.tests/odr-def-decl.sh b/testsuite/dwz.tests/odr-def-decl.sh
index 943f05e..8905e52 100644
--- a/testsuite/dwz.tests/odr-def-decl.sh
+++ b/testsuite/dwz.tests/odr-def-decl.sh
@@ -7,13 +7,13 @@ cp $execs/def-decl 1
 verify-dwarf.sh 1
 
 cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
-[ $cnt -eq 4 ]
+[ $cnt -eq 5 ]
 
 $execs/dwz-for-test --odr 1 --devel-ignore-size
 
 verify-dwarf.sh 1
 
 cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
-[ $cnt -eq 3 ]
+[ $cnt -eq 2 ]
 
 rm -f 1
diff --git a/testsuite/dwz.tests/odr-loc-2.cc b/testsuite/dwz.tests/odr-loc-2.cc
index 39ef5cf..7cf832b 100644
--- a/testsuite/dwz.tests/odr-loc-2.cc
+++ b/testsuite/dwz.tests/odr-loc-2.cc
@@ -11,3 +11,4 @@ struct aaa
 };
 
 struct aaa var2;
+struct bbb var4;
diff --git a/testsuite/dwz.tests/odr-loc.cc b/testsuite/dwz.tests/odr-loc.cc
index 10efd75..953fd66 100644
--- a/testsuite/dwz.tests/odr-loc.cc
+++ b/testsuite/dwz.tests/odr-loc.cc
@@ -10,6 +10,7 @@ struct aaa
 };
 
 struct aaa var1;
+struct ccc var3;
 
 int
 main (void)
diff --git a/testsuite/dwz.tests/odr.cc b/testsuite/dwz.tests/odr.cc
index 3f9255b..9505cb3 100644
--- a/testsuite/dwz.tests/odr.cc
+++ b/testsuite/dwz.tests/odr.cc
@@ -13,8 +13,10 @@ namespace ns {
 
 #if NAMESPACE
 KIND ns::aaa var1;
+KIND ns::ccc var3;
 #else
 KIND aaa var1;
+KIND ccc var3;
 #endif
 
 int

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-16 11:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 11:11 [committed][testsuite] Fix odr tests with clang Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).