public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Nils-Christian Kempke <nckempke@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] testsuite/lib: add check_optional_entry for GDBInfoSymbols
Date: Tue, 31 May 2022 14:46:04 +0000 (GMT)	[thread overview]
Message-ID: <20220531144604.1CF0C395A027@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c8ff7f6d9240026ef7d87e3efae5b127fdba365

commit 5c8ff7f6d9240026ef7d87e3efae5b127fdba365
Author: Nils-Christian Kempke <nils-christian.kempke@intel.com>
Date:   Tue May 31 16:43:44 2022 +0200

    testsuite/lib: add check_optional_entry for GDBInfoSymbols
    
    There was already a similar functionality for the GDBInfoModuleSymbols.
    This just extends the GDBInfoSymbols.  We will use this feature in a
    later commit to make a testcase less GNU specific and more flexible for
    other compilers.
    
    Namely, in gdb.fortran/info-types.exp currenlty
    GDBInfoSymbols::check_entry is used to verify and test the output of the
    info symbols command.  The test, however was written with gfortran as a
    basis and some of the tests are not fair with e.g. ifx and ifort as
    they test for symbols that are not actually required to be emitted.  The
    lines
       GDBInfoSymbols::check_entry "${srcfile}" "" "${character1}"
    and
       GDBInfoSymbols::check_entry "${srcfile}" "37" "Type s1;"
    
    check for types that are either not used in the source file (character1)
    or should not be emitted by the compiler at global scope (s1) thus no
    appearing in the info symbols command.  In order to fix this we will
    later use the newly introduced check_optional_entry over check_entry.

Diff:
---
 gdb/testsuite/lib/sym-info-cmds.exp | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/lib/sym-info-cmds.exp b/gdb/testsuite/lib/sym-info-cmds.exp
index f0272a03349..ce878f0d502 100644
--- a/gdb/testsuite/lib/sym-info-cmds.exp
+++ b/gdb/testsuite/lib/sym-info-cmds.exp
@@ -163,6 +163,16 @@ namespace eval GDBInfoSymbols {
 	gdb_assert {[regexp -- $pattern $_header]} $testname
     }
 
+    # Call check_entry_1 with OPTIONAL == 0.
+    proc check_entry { filename lineno text { testname "" } } {
+	check_entry_1 $filename $lineno $text 0 $testname
+    }
+
+    # Call check_entry_1 with OPTIONAL == 1.
+    proc check_optional_entry { filename lineno text { testname "" } } {
+	check_entry_1 $filename $lineno $text 1 $testname
+    }
+
     # Check that we have an entry in _entries matching FILENAME,
     # LINENO, and TEXT.  If LINENO is the empty string it is replaced
     # with the string NONE in order to match a similarly missing line
@@ -174,7 +184,7 @@ namespace eval GDBInfoSymbols {
     # If a matching entry is found then it is removed from the
     # _entries list, this allows us to check for duplicates using the
     # check_no_entry call.
-    proc check_entry { filename lineno text { testname "" } } {
+    proc check_entry_1 { filename lineno text optional testname } {
 	variable _entries
 	variable _last_command
 
@@ -209,7 +219,11 @@ namespace eval GDBInfoSymbols {
 	}
 
 	set _entries $new_entries
-	gdb_assert { $found_match } $testname
+	if { $optional && ! $found_match } {
+	    unsupported $testname
+	} else {
+	    gdb_assert { $found_match } $testname
+	}
     }
 
     # Check that there is no entry in the _entries list matching


                 reply	other threads:[~2022-05-31 14:46 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=20220531144604.1CF0C395A027@sourceware.org \
    --to=nckempke@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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).