From patchwork Sun Mar 31 19:08:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 32109 Received: (qmail 83073 invoked by alias); 31 Mar 2019 19:08:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 82984 invoked by uid 89); 31 Mar 2019 19:08:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS, URIBL_BLOCKED autolearn=ham version=3.3.1 spammy=MERCHANTABILITY, merchantability, fitness, PARTICULAR X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 31 Mar 2019 19:08:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1554059297; x=1585595297; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nZc97xqRh3+/RmT+5Jb849kF+huwmuJp4GOTAfAwk78=; b=nuejPFdNoi66rXF6nWC9+g1BF6xgB2lhOQYLnc3zj6MNR+bJz0mrPzWu AQfnBjt3iKEAiGiHmI+4jWkUAr/JcQ==; Received: from 212.135-131-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.131.135.212]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 31 Mar 2019 21:08:09 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA 2/3] New test for 'info sources [-d | -b] [--] [REGEXP]'. Date: Sun, 31 Mar 2019 21:08:02 +0200 Message-Id: <20190331190803.7248-3-philippe.waroquiers@skynet.be> In-Reply-To: <20190331190803.7248-1-philippe.waroquiers@skynet.be> References: <20190331190803.7248-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes gdb/testsuite/ChangeLog 2019-03-31 Philippe Waroquiers * gdb.base/info_sources.exp: New file. * gdb.base/info_sources.c: New file. * gdb.base/info_sources_base.c: New file. --- gdb/testsuite/gdb.base/info_sources.c | 23 ++++++ gdb/testsuite/gdb.base/info_sources.exp | 85 ++++++++++++++++++++++ gdb/testsuite/gdb.base/info_sources_base.c | 5 ++ 3 files changed, 113 insertions(+) create mode 100644 gdb/testsuite/gdb.base/info_sources.c create mode 100644 gdb/testsuite/gdb.base/info_sources.exp create mode 100644 gdb/testsuite/gdb.base/info_sources_base.c diff --git a/gdb/testsuite/gdb.base/info_sources.c b/gdb/testsuite/gdb.base/info_sources.c new file mode 100644 index 0000000000..75fab6df70 --- /dev/null +++ b/gdb/testsuite/gdb.base/info_sources.c @@ -0,0 +1,23 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +extern void some_other_func (void); +int main () +{ + some_other_func (); + return 0; +} diff --git a/gdb/testsuite/gdb.base/info_sources.exp b/gdb/testsuite/gdb.base/info_sources.exp new file mode 100644 index 0000000000..e5a08f1c5e --- /dev/null +++ b/gdb/testsuite/gdb.base/info_sources.exp @@ -0,0 +1,85 @@ +# Copyright 2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test 'info sources [-d | -b] [--] [REGEẌ]' + +standard_testfile .c info_sources_base.c + +if {[prepare_for_testing $testfile.exp $testfile \ + [list $srcfile $srcfile2] debug]} { + untested $testfile.exp + return -1 +} + +proc test_info_sources {args expect_seen_info_sources expect_seen_info_sources_base} { + global gdb_prompt + + set seen_info_sources 0 + set seen_info_sources_base 0 + set cmd [concat "info sources " $args] + gdb_test_multiple $cmd $cmd { + -re "^\[^,\]*info_sources.c(, |\[\r\n\]+)" { + set seen_info_sources 1 + exp_continue + } + -re "^\[^,\]*info_sources_base.c(, |\[\r\n\]+)" { + set seen_info_sources_base 1 + exp_continue + } + -re ", " { + exp_continue + } + -re "$gdb_prompt $" { + if {$seen_info_sources == $expect_seen_info_sources \ + && $seen_info_sources_base == $expect_seen_info_sources_base} { + pass $cmd + } else { + fail $cmd + } + } + } +} + +if ![runto_main] { + untested $testfile.exp + return -1 +} +gdb_test "break some_other_func" "" + +gdb_test "continue" + +# List both files with no regexp: +test_info_sources "" 1 1 +# Same but with option terminator: +test_info_sources "--" 1 1 + +# List both files with regexp matching anywhere in the filenames: +test_info_sources "info_sources" 1 1 +test_info_sources "gdb.base" 1 1 + +# List both files with regexp matching the filename basenames: +test_info_sources "-b info_sources" 1 1 +test_info_sources "-b -- info_sources" 1 1 + +# List only the file with basename matching regexp: +test_info_sources "-b base" 0 1 + +# List the files with dirname matching regexp: +test_info_sources "-d base" 1 1 + +# Test non matching regexp, with option terminator: +test_info_sources "-b -- -d" 0 0 +test_info_sources "-d -- -d" 0 0 + diff --git a/gdb/testsuite/gdb.base/info_sources_base.c b/gdb/testsuite/gdb.base/info_sources_base.c new file mode 100644 index 0000000000..a4c03a0341 --- /dev/null +++ b/gdb/testsuite/gdb.base/info_sources_base.c @@ -0,0 +1,5 @@ +void some_other_func (void) +{ + return; +} +