Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH 3/3] test case
Date: Mon, 06 Aug 2012 15:48:00 -0000	[thread overview]
Message-ID: <2510564.KTj9X6l9jh@qiyao.dyndns.org> (raw)
In-Reply-To: <87r4rnnafw.fsf@fleche.redhat.com>

On Friday, August 03, 2012 11:37:39 AM Tom Tromey wrote:
> This looks good but I did not see a test for abbreviated multi-word
> commands, and I think that would be a useful addition.

Right, a test for a abbreviated multi-word is added.

+    # Full command parameters are included in the notification when a
+    # abbreviated one is typed.
+    mi_gdb_test "set ch type on" \
+	".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \
+	"\"set ch type on\""

Except this, there is no other changes.

-- 
Yao (齐尧)

gdb/testsuite:

2012-08-06  Yao Qi  <yao@codesourcery.com>

	* gdb.mi/mi-cmd-param-changed.exp: New.
	* gdb.mi/mi-cli.exp: Update for MI notification "=cmd-param-changed".
	* gdb.mi/mi-var-rtti.exp, gdb.mi/mi2-cli.exp: Likewise.
	* gdb.mi/mi2-prompt.exp: Likewise.
---
 gdb/testsuite/gdb.mi/mi-cli.exp               |    4 +-
 gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp |  103 +++++++++++++++++++++++++
 gdb/testsuite/gdb.mi/mi-var-rtti.exp          |    2 +-
 gdb/testsuite/gdb.mi/mi2-cli.exp              |    4 +-
 gdb/testsuite/gdb.mi/mi2-prompt.exp           |    5 +-
 5 files changed, 111 insertions(+), 7 deletions(-)
 create mode 100644 gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp

diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index b7abbc7..f487cbd 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -70,7 +70,7 @@ set line_callee4_body [expr $line_callee4_head + 2]
 set line_callee4_next [expr $line_callee4_body + 1]
 
 mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
-  {\^done} \
+  ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \
   "-interpreter-exec console \"set args foobar\""
 
 mi_gdb_test "-interpreter-exec console \"show args\"" \
@@ -90,7 +90,7 @@ mi_gdb_test "-interpreter-exec console \"info break\"" \
   "-interpreter-exec console \"info break\""
 
 mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
-  {\^done} \
+  ".*=cmd-param-changed,param=\"listsize\",value=\"1\".*\\^done" \
   "-interpreter-exec console \"set listsize 1\""
 
 # {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done }
diff --git a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
new file mode 100644
index 0000000..8c2195c
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
@@ -0,0 +1,103 @@
+# Copyright 2012 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 <http://www.gnu.org/licenses/>.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+standard_testfile basics.c
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+     untested mi-cmd-param-changed.exp
+     return -1
+}
+
+proc test_command_param_changed { } { with_test_prefix "cmd param" {
+    if [mi_gdb_start] {
+	return
+    }
+    mi_run_to_main
+
+    foreach opt { "on" "off" "step" } {
+	mi_gdb_test "set scheduler-locking ${opt}" \
+	    ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
+	    "\"set scheduler-locking ${opt}\""
+    }
+    foreach opt { "on" "off" "step" } {
+	mi_gdb_test "interpreter-exec console \"set scheduler-locking ${opt}\"" \
+	    ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
+	    "interpreter-exec \"set scheduler-locking ${opt}\""
+    }
+    # Don't emit MI notification for request from MI.
+    mi_gdb_test "-gdb-set scheduler-locking on" \
+	{\^done} \
+	"\"set scheduler-locking on\" no event (requested by MI)"
+
+    mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \
+	"\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \
+	"\"set scheduler-locking step\" no event (requested by MI interp)"
+    mi_gdb_test "set scheduler-locking step" \
+	"\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \
+	"\"set scheduler-locking stepr\" no event"
+
+
+    foreach command { "circular-trace-buffer" "check type" } {
+
+	# The default value of each command option may be different, so we first
+	# set it to 'off', and this may or may not trigger MI notification.
+	mi_gdb_test "set ${command} off" ".*\\^done" "\"set ${command}\" warmup"
+
+	foreach boolean_opt { "on" "off" } {
+	    mi_gdb_test "set ${command} ${boolean_opt}" \
+		".*=cmd-param-changed,param=\"${command}\",value=\"${boolean_opt}\".*\\^done" \
+		"\"set ${command} ${boolean_opt}\""
+	}
+	mi_gdb_test "set ${command} off" \
+	    "\\&\"set ${command} off\\\\n\"\r\n\\^done" \
+	    "\"set ${command}\" no event"
+    }
+
+
+    foreach command { "trace-notes" "remote exec-file" } {
+	foreach str_opt { "foo" "bar" } {
+	    mi_gdb_test "set ${command} ${str_opt}" \
+		".*=cmd-param-changed,param=\"${command}\",value=\"${str_opt}\".*\\^done" \
+		"\"set ${command} ${str_opt}\""
+	}
+	mi_gdb_test "set ${command} bar" \
+	    "\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \
+	    "\"set ${command} bar\" no event"
+    }
+
+    # No notification is emitted for 'maint set' commands.
+    foreach command { "profile" "show-debug-regs" } {
+	foreach boolean_opt { "on" "off" } {
+	    mi_gdb_test "maint set ${command} ${boolean_opt}" \
+		"\\&\"maint set ${command} ${boolean_opt}\\\\n\"\r\n\\^done" \
+		"\"maint set ${command} ${boolean_opt}\""
+	}
+    }
+
+    # Full command parameters are included in the notification when a
+    # abbreviated one is typed.
+    mi_gdb_test "set ch type on" \
+	".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \
+	"\"set ch type on\""
+
+    mi_gdb_exit
+}}
+
+test_command_param_changed
+
+return 0
diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp
index a718ffb..dc2f922 100644
--- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp
@@ -37,7 +37,7 @@ mi_prepare_inline_tests $srcfile
 # Enable using RTTI to determine real types of the objects
 proc set_print_object {state testname} {
     mi_gdb_test "-interpreter-exec console \"set print object ${state}\"" \
-        {\^done} \
+	"(.*=cmd-param-changed,param=\"print object\",value=\"${state}\".*|)\\^done" \
         "-interpreter-exec console \"set print object ${state}\" in $testname"
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp
index e84b191..9ab7518 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi2-cli.exp
@@ -69,7 +69,7 @@ set line_callee4_head [gdb_get_line_number "callee4 ("]
 set line_callee4_body [expr $line_callee4_head + 2]
 
 mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
-  {\^done} \
+  ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \
   "-interpreter-exec console \"set args foobar\""
 
 mi_gdb_test "-interpreter-exec console \"show args\"" \
@@ -89,7 +89,7 @@ mi_gdb_test "-interpreter-exec console \"info break\"" \
   "-interpreter-exec console \"info break\""
 
 mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
-  {\^done} \
+  ".*=cmd-param-changed,param=\"listsize\",value=\"1\".*\\^done" \
   "-interpreter-exec console \"set listsize 1\""
 
 # {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done }
diff --git a/gdb/testsuite/gdb.mi/mi2-prompt.exp b/gdb/testsuite/gdb.mi/mi2-prompt.exp
index 6145c38..eb9edec 100644
--- a/gdb/testsuite/gdb.mi/mi2-prompt.exp
+++ b/gdb/testsuite/gdb.mi/mi2-prompt.exp
@@ -23,8 +23,9 @@ if [mi_gdb_start] {
 
 # Check console 'set prompt' does not affect the MI output.
 
-mi_gdb_test {-interpreter-exec console "set prompt (banana) "} {\^done} \
-	    "console set prompt"
+mi_gdb_test {-interpreter-exec console "set prompt (banana) "} \
+    ".*=cmd-param-changed,param=\"prompt\",value=\"\\(banana\\) \".*\\^done" \
+    "console set prompt"
 mi_gdb_test "-break-list" ".*}" "-break-list"
 
 gdb_exit
-- 
1.7.7.6



  reply	other threads:[~2012-08-06 15:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 11:22 [RCF 0/3 V3] MI notification of command parameter change Yao Qi
2012-08-03 11:22 ` [PATCH 2/3] attach to command_param_changed observer Yao Qi
2012-08-03 11:30   ` Eli Zaretskii
2012-08-03 17:36   ` Tom Tromey
2012-08-03 11:22 ` [PATCH 1/3] new observer command_param_changed Yao Qi
2012-08-03 17:35   ` Tom Tromey
2012-08-06 15:44     ` Yao Qi
2012-08-06 20:21       ` Tom Tromey
2012-08-07  2:58         ` Yao Qi
2012-08-08 18:11           ` Tom Tromey
2012-08-03 11:22 ` [PATCH 3/3] test case Yao Qi
2012-08-03 17:37   ` Tom Tromey
2012-08-06 15:48     ` Yao Qi [this message]
2012-08-06 20:21       ` Tom Tromey
2012-08-10  0:57 ` [committed]: [RCF 0/3 V3] MI notification of command parameter change Yao Qi

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=2510564.KTj9X6l9jh@qiyao.dyndns.org \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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