From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 15D003858D35 for ; Fri, 24 Mar 2023 23:58:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15D003858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 5663C313AC9B; Sat, 25 Mar 2023 00:58:39 +0100 (CET) Received: by csb.redhat.com (Postfix, from userid 10916) id 19833EE3BC; Sat, 25 Mar 2023 00:58:39 +0100 (CET) From: Mark Wielaard To: debugedit@sourceware.org Cc: Mark Wielaard Subject: [PATCH 3/3] debugedit: Simplify and extend .debug_line tests Date: Sat, 25 Mar 2023 00:58:07 +0100 Message-Id: <20230324235807.2335399-3-mark@klomp.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230324235807.2335399-1-mark@klomp.org> References: <20230324235807.2335399-1-mark@klomp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3036.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The debugedit .debug_line tests were only checking the directory table, skipping the file name table assuming those would not be include a directory element. But some compilers output the file names as absolute paths (so ignoring the directory table entries, which is slightly inefficient). Check both tables now using sed to replace the directory strings. Signed-off-by: Mark Wielaard --- tests/debugedit.at | 74 ++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/tests/debugedit.at b/tests/debugedit.at index 19ab7dc..b3387b8 100644 --- a/tests/debugedit.at +++ b/tests/debugedit.at @@ -468,18 +468,17 @@ AT_SETUP([debugedit .debug_line objects DWARF4]) AT_KEYWORDS([debuginfo] [debugedit]) DEBUGEDIT_SETUP([-gdwarf-4]) -AT_DATA([expout], -[/foo/bar/baz -/foo/bar/baz/subdir_headers -]) +$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [[1234]]" \ + | sed -e "s@$(pwd)@/foo/bar/baz@" | tee expout AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) AT_CHECK([[ $READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ - | grep -A3 "The Directory Table" | grep "^ [123]" \ - | grep /foo/ | cut -c5- | sort + | grep -E -A5 "The (Directory|File Name) Table" | grep "^ [1234]" ]],[0],[expout]) AT_CLEANUP @@ -494,19 +493,18 @@ AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) DEBUGEDIT_SETUP([-gdwarf-5]) -AT_DATA([expout], -[foo/bar/baz -foo/bar/baz/subdir_bar -foo/bar/baz/subdir_headers -]) +$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [[01234]]" | cut -f3 -d: \ + | sed -e "s@$(pwd)@/foo/bar/baz@" | tee expout AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) AT_CHECK([[ $READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ - | grep -A5 "The Directory Table" | grep "^ [0123]" \ - | cut -f2- -d/ | grep ^foo/ | sort -u + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [01234]" | cut -f3 -d: ]],[0],[expout]) AT_CLEANUP @@ -519,16 +517,16 @@ AT_SETUP([debugedit .debug_line partial DWARF4]) AT_KEYWORDS([debuginfo] [debugedit]) DEBUGEDIT_SETUP([-gdwarf-4]) -AT_DATA([expout], -[/foo/bar/baz -/foo/bar/baz/subdir_headers -]) +$READELF --debug-dump=line ./foobarbaz.part.o \ + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [[1234]]" \ + | sed -e "s@$(pwd)@/foo/bar/baz@" | tee expout AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) AT_CHECK([[ $READELF --debug-dump=line ./foobarbaz.part.o \ - | grep -A3 "The Directory Table" | grep "^ [123]" \ - | grep /foo/ | cut -c5- | sort + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [1234]" ]],[0],[expout]) AT_CLEANUP @@ -543,17 +541,16 @@ AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) DEBUGEDIT_SETUP([-gdwarf-5]) -AT_DATA([expout], -[foo/bar/baz -foo/bar/baz/subdir_bar -foo/bar/baz/subdir_headers -]) +$READELF --debug-dump=line ./foobarbaz.part.o \ + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [[01234]]" | cut -f3 -d: \ + | sed -e "s@$(pwd)@/foo/bar/baz@" | tee expout AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) AT_CHECK([[ $READELF --debug-dump=line ./foobarbaz.part.o \ - | grep -A5 "The Directory Table" | grep "^ [0123]" \ - | cut -f2- -d/ | grep ^foo/ | sort -u + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [01234]" | cut -f3 -d: ]],[0],[expout]) AT_CLEANUP @@ -566,16 +563,16 @@ AT_SETUP([debugedit .debug_line exe DWARF4]) AT_KEYWORDS([debuginfo] [debugedit]) DEBUGEDIT_SETUP([-gdwarf-4]) -AT_DATA([expout], -[/foo/bar/baz -/foo/bar/baz/subdir_headers -]) +$READELF --debug-dump=line ./foobarbaz.exe \ + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [[1234]]" \ + | sed -e "s@$(pwd)@/foo/bar/baz@" | tee expout AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) AT_CHECK([[ $READELF --debug-dump=line ./foobarbaz.exe \ - | grep -A3 "The Directory Table" | grep "^ [123]" \ - | grep /foo/ | cut -c5- | sort + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [1234]" ]],[0],[expout]) AT_CLEANUP @@ -590,17 +587,16 @@ AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) DEBUGEDIT_SETUP([-gdwarf-5]) -AT_DATA([expout], -[foo/bar/baz -foo/bar/baz/subdir_bar -foo/bar/baz/subdir_headers -]) +$READELF --debug-dump=line ./foobarbaz.exe \ + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [[01234]]" | cut -f3 -d: \ + | sed -e "s@$(pwd)@/foo/bar/baz@" | tee expout AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) AT_CHECK([[ $READELF --debug-dump=line ./foobarbaz.exe \ - | grep -A5 "The Directory Table" | grep "^ [0123]" \ - | cut -f2- -d/ | grep ^foo/ | sort -u + | grep -E -A5 "The (Directory|File Name) Table" \ + | grep "^ [01234]" | cut -f3 -d: ]],[0],[expout]) AT_CLEANUP -- 2.31.1