Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Sergio Durigan Junior <sergiodj@redhat.com>,
	Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org,
	Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [PATCH] gdb/testsuite: fix gdb.base/with.exp failure with, native-extended-gdbserver (was: New FAIL on gdb.base/with.exp on native-extended-gdbserver)
Date: Mon, 11 May 2020 10:54:57 -0400	[thread overview]
Message-ID: <0761e02d-dd1c-22fe-3d10-4ae5849cdd73@simark.ca> (raw)
In-Reply-To: <87wofvtal6.fsf_-_@redhat.com>

On 2019-08-02 7:24 p.m., Sergio Durigan Junior wrote:
> On Wednesday, July 03 2019, Pedro Alves wrote:
> 
>> On 6/18/19 1:38 AM, Pedro Alves wrote:
>>>
>>>  (gdb) help with
>>>  Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
>>>  Usage: with SETTING [VALUE] [-- COMMAND]
>>>  Usage: w SETTING [VALUE] [-- COMMAND]
>>>  With no COMMAND, repeats the last executed command.
>>>  SETTING is any setting settable with the "set" command.
>>>  E.g.:
>>>    with language pascal -- print obj
>>>    with print elements unlimited -- print obj
>>>
>>
>> I've merged this in now.
> 
> Hi Pedro,
> 
> First of all, thanks for the nice feature.
> 
> BuildBot has unfortunately caught a new failure on gdb.base/with.exp
> when run agains native-extended-gdbserver:
> 
>   https://sourceware.org/ml/gdb-testers/2019-q3/msg00213.html
> 
>   new FAIL: gdb.base/with.exp: repeat: reinvoke with no previous command to relaunch
> 
> I've also found it here when preparing a new Fedora GDB release.
> 
> Thanks,

Here's a patch for this

From 4927107e4d99cc81e36c699d5716ea8d76fb7101 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>
Date: Mon, 11 May 2020 10:17:38 -0400
Subject: [PATCH] gdb/testsuite: fix gdb.base/with.exp failure with
 native-extended-gdbserver

I see this failure when running:

    $ make check TESTS="gdb.base/with.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"
    FAIL: gdb.base/with.exp: repeat: reinvoke with no previous command to relaunch

This test issues `with language ada` and expects GDB to complain that
there is no command to repeat (either because the history is empty or
the previous command is non-repeatable).  However, with the
native-extended-gdbserver board, the `set remote exec-file` command is
issued during `clean_restart`, and it is a repeatable command, so GDB
doesn't print the expected message:

    (gdb) set remote exec-file /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/with/with^M
    (gdb) with language ada^M
    (gdb) FAIL: gdb.base/with.exp: repeat: reinvoke with no previous command to relaunch

Fix it by using gdb_spawn instead of clean_restart.  gdb_spawn fires up
GDB and does not issue any command, not even `set height` and `set
width`.

I've also added a separate test for trying to repeat a non-repeatable
command, since that's a slightly different case than trying to repeat
without history.

gdb/testsuite/ChangeLog:

	* gdb.base/with.exp: Start GDB with gdb_spawn for repeat test.
	Add test for trying to repeat a non-repeatable command.
---
 gdb/testsuite/gdb.base/with.exp | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/with.exp b/gdb/testsuite/gdb.base/with.exp
index a60ccf307468..e86e49618a7f 100644
--- a/gdb/testsuite/gdb.base/with.exp
+++ b/gdb/testsuite/gdb.base/with.exp
@@ -175,15 +175,22 @@ with_test_prefix "user-defined" {

 # Check repeating.
 with_test_prefix "repeat" {
-    clean_restart $binfile
+    # Start GDB like this (as opposed to gdb_start/clean_restart) for the first
+    # test to make sure no command is issued after starting the GDB process.
+    gdb_exit
+    gdb_spawn
+    gdb_test "" "" "wait for initial prompt"

-    # "with" with no command reinvokes the previous command.
+    # "with" with no command in the history.
     gdb_test "with language ada" \
 	"No previous command to relaunch" \
 	"reinvoke with no previous command to relaunch"

-    gdb_test "print g_s" " = {a = 1, b = 2, c = 3}"
+    # For the rest of this scope we need to have the binary loaded.
+    clean_restart $binfile

+    # "with" with no command reinvokes the previous command.
+    gdb_test "print g_s" " = {a = 1, b = 2, c = 3}"
     gdb_test "with language ada" \
 	" = \\(a => 1, b => 2, c => 3\\)" \
 	"reinvoke with language"
@@ -202,6 +209,12 @@ with_test_prefix "repeat" {
 	    pass $test
 	}
     }
+
+    # "with" after a non-repeatable command.
+    gdb_test "display 123" "1: 123 = 123"
+    gdb_test "with language ada" \
+	"No previous command to relaunch" \
+	"reinvoke after a non-repeatable command"
 }

 # Basic run control.
-- 
2.26.2




      reply	other threads:[~2020-05-11 14:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18  0:39 [PATCH v2 0/4] Introduce the "with" command Pedro Alves
2019-06-18  0:39 ` [PATCH v2 1/4] Fix defaults of some "maint test-settings" subcommands Pedro Alves
2019-06-18  0:39 ` [PATCH v2 3/4] "maint test-settings set/show" -> "maint set/show test-settings" Pedro Alves
2019-06-18 16:35   ` Eli Zaretskii
2019-06-18  0:39 ` [PATCH v2 2/4] Fix a few comments in maint-test-settings.c Pedro Alves
2019-06-18  0:39 ` [PATCH v2 4/4] Introduce the "with" command Pedro Alves
2019-06-18 16:42   ` Eli Zaretskii
2019-06-19 15:46     ` Pedro Alves
2019-06-19 16:53       ` Eli Zaretskii
2019-06-19 17:20         ` [PATCH v2.1] " Pedro Alves
2019-06-22 10:30           ` Philippe Waroquiers
2019-06-22 11:48             ` Pedro Alves
2019-06-22 12:09               ` Philippe Waroquiers
2019-06-19  0:34 ` [PATCH v2 0/4] " Philippe Waroquiers
2019-06-19 13:05   ` Pedro Alves
2019-06-19 13:40     ` Philippe Waroquiers
2019-07-03 12:49 ` Pedro Alves
2019-08-02 23:24   ` New FAIL on gdb.base/with.exp on native-extended-gdbserver (was: Re: [PATCH v2 0/4] Introduce the "with" command) Sergio Durigan Junior
2020-05-11 14:54     ` Simon Marchi [this message]

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=0761e02d-dd1c-22fe-3d10-4ae5849cdd73@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=philippe.waroquiers@skynet.be \
    --cc=sergiodj@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