This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/3] test case


gdb/testsuite:

2012-08-03  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 |   97 +++++++++++++++++++++++++
 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, 105 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..362194b
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
@@ -0,0 +1,97 @@
+# 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" } {
+	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}\""
+	}
+    }
+
+    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..f283ca0 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=\"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]