From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49889 invoked by alias); 10 Dec 2019 17:20:20 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 49767 invoked by uid 89); 10 Dec 2019 17:20:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Cc: Michael Matz Subject: [RFC 10/13][odr, testsuite] Add test-case odr-loc.sh Message-ID: <20191210172013.GA14048@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q4/txt/msg00137.txt.bz2 Hi, Add a test-case that tests whether --odr works in conjunction with --devel-ignore-locus. Any comments? Thanks, - Tom [odr, testsuite] Add test-case odr-loc.sh 2019-12-10 Tom de Vries * 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 2ab8405..e15d604 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ TEST_EXECS = hello dw2-restrict py-section-script dwz-for-test min two-typedef \ dw2-skip-prologue start implptr-64bit-d2o4a8r8t0 hello-gold-gdb-index \ start-gold hello-gnu-pubnames varval $(TEST_EXECS_DWARF_ASM) \ odr-struct odr-class odr-union odr-struct-ns odr-class-ns \ - odr-union-ns + odr-union-ns odr-loc hello: $(CC) $(TEST_SRC)/hello.c -o $@ -g @@ -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