public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed 10/13][odr, testsuite] Add test-case odr-loc.sh
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <20200106160959.GA20066@delia> (raw)

Hi,

Add a test-case that tests whether --odr works in conjunction with
--devel-ignore-locus.

Committed to trunk.

Thanks,
- Tom

[odr, testsuite] Add test-case odr-loc.sh

2020-01-06  Tom de Vries  <tdevries@suse.de>

	* Makefile (odr-loc): New target.
	(TEST_EXECS): Add odr-loc.
	* testsuite/dwz.tests/odr-loc-2.cc: New test.
	* testsuite/dwz.tests/odr-loc.cc: New test.
	* testsuite/dwz.tests/odr-loc.sh: New test.

---
 Makefile                         |  7 ++++++-
 testsuite/dwz.tests/odr-loc-2.cc | 13 +++++++++++++
 testsuite/dwz.tests/odr-loc.cc   | 18 ++++++++++++++++++
 testsuite/dwz.tests/odr-loc.sh   | 39 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1d5c9ca..d6bf2a8 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ TEST_EXECS_x86_64 = py-section-script dw2-skip-prologue \
 TEST_EXECS = hello dwz-for-test min two-typedef start hello-gold-gdb-index \
 	start-gold hello-gnu-pubnames $(TEST_EXECS_DWARF_ASM) \
 	$(TEST_EXECS_$(UNAME)) odr-struct odr-class odr-union odr-struct-ns \
-	odr-class-ns odr-union-ns
+	odr-class-ns odr-union-ns odr-loc
 
 UNAME:=$(shell uname -p)
 
@@ -122,6 +122,11 @@ odr-union-ns:
 	$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
 	  -DKIND=union -DNAMESPACE=1
 
+odr-loc:
+	$(CXX) $(TEST_SRC)/odr-loc.cc $(TEST_SRC)/odr-loc-2.cc -I$(TEST_SRC) \
+	  -o $@ -g
+
+
 # On some systems we need to set and export DEJAGNU to suppress
 # WARNING: Couldn't find the global config file.
 DEJAGNU ?= /dev/null
diff --git a/testsuite/dwz.tests/odr-loc-2.cc b/testsuite/dwz.tests/odr-loc-2.cc
new file mode 100644
index 0000000..39ef5cf
--- /dev/null
+++ b/testsuite/dwz.tests/odr-loc-2.cc
@@ -0,0 +1,13 @@
+struct bbb
+{
+  int member_four;
+};
+struct ccc;
+
+struct aaa
+{
+  struct bbb *member_one;
+  struct ccc *member_two;
+};
+
+struct aaa var2;
diff --git a/testsuite/dwz.tests/odr-loc.cc b/testsuite/dwz.tests/odr-loc.cc
new file mode 100644
index 0000000..10efd75
--- /dev/null
+++ b/testsuite/dwz.tests/odr-loc.cc
@@ -0,0 +1,18 @@
+struct bbb;
+struct ccc {
+  int member_three;
+};
+
+struct aaa
+{
+  struct bbb *member_one;
+  struct ccc *member_two;
+};
+
+struct aaa var1;
+
+int
+main (void)
+{
+  return 0;
+}
diff --git a/testsuite/dwz.tests/odr-loc.sh b/testsuite/dwz.tests/odr-loc.sh
new file mode 100644
index 0000000..4dc8fb3
--- /dev/null
+++ b/testsuite/dwz.tests/odr-loc.sh
@@ -0,0 +1,39 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+    exit 77
+fi
+
+cp $execs/odr-loc 1
+
+for name in aaa bbb ccc; do
+    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    [ $cnt -eq 2 ]
+done
+
+$execs/dwz-for-test --odr 1
+
+verify-dwarf.sh 1
+
+for name in aaa bbb ccc; do
+    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    case $name in
+	aaa)
+	    [ $cnt -eq 2 ]
+	    ;;
+	*)
+	    [ $cnt -eq 1 ]
+	    ;;
+    esac
+done
+
+cp $execs/odr-loc 1
+
+$execs/dwz-for-test --odr --devel-ignore-locus 1
+
+verify-dwarf.sh 1
+
+for name in aaa bbb ccc; do
+    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    [ $cnt -eq 1 ]
+done
+
+rm -f 1

                 reply	other threads:[~2020-01-06 16:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106160959.GA20066@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).