public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 08/14] gdb/testsuite: make test names unique in gdb.python/py-prompt.exp
Date: Mon,  8 Mar 2021 18:37:05 +0000	[thread overview]
Message-ID: <62307ee470b6da358a83beae74e32b464b341fd3.1615228575.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1615228575.git.andrew.burgess@embecosm.com>

Use with_test_prefix to make test names unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-prompt.exp: Add with_test_prefix to make test
	names unique.
---
 gdb/testsuite/ChangeLog                |  5 ++
 gdb/testsuite/gdb.python/py-prompt.exp | 85 ++++++++++++++------------
 2 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-prompt.exp b/gdb/testsuite/gdb.python/py-prompt.exp
index 6eed7159b37..d030ef67168 100644
--- a/gdb/testsuite/gdb.python/py-prompt.exp
+++ b/gdb/testsuite/gdb.python/py-prompt.exp
@@ -52,28 +52,31 @@ global gdb_prompt
 # gdb_test expects it not to be there.
 set gdb_prompt "\[(\]Foo\[)\]"
 
-set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing on\""]
-prompt_gdb_start
-gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
-	 ".*prompt is \"$gdb_prompt \".*" \
-	 "show prompt gets the correct result"
-gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
-	 "retrieving the prompt causes no extra prompt_hook calls"
-gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
-	 "prompt_hook argument is default prompt."
-gdb_exit
-
+with_test_prefix "set editing on" {
+    set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing on\""]
+    prompt_gdb_start
+    gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
+	".*prompt is \"$gdb_prompt \".*" \
+	"show prompt gets the correct result"
+    gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
+	"retrieving the prompt causes no extra prompt_hook calls"
+    gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
+	"prompt_hook argument is default prompt."
+    gdb_exit
+}
 
-set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing off\""]
-prompt_gdb_start
-gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
-	 ".*prompt is \"$gdb_prompt \".*" \
-	 "show prompt gets the correct result 2"
-gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
-	 "retrieving the prompt causes no extra prompt_hook calls 2"
-gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
-	 "prompt_hook argument is default prompt. 2"
-gdb_exit
+with_test_prefix "set editing off" {
+    set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing off\""]
+    prompt_gdb_start
+    gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
+	".*prompt is \"$gdb_prompt \".*" \
+	"show prompt gets the correct result 2"
+    gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
+	"retrieving the prompt causes no extra prompt_hook calls 2"
+    gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
+	"prompt_hook argument is default prompt. 2"
+    gdb_exit
+}
 
 if {![can_spawn_for_attach]} {
     set GDBFLAGS $saved_gdbflags
@@ -89,15 +92,17 @@ set GDBFLAGS [concat $GDBFLAGS " -ex \"attach $testpid\""]
 set GDBFLAGS [concat $GDBFLAGS " -ex \"continue&\""]
 
 # sync_execution = 1 is_running = 1
-prompt_gdb_start
-gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
-	 ".*prompt is \"$gdb_prompt \".*" \
-	 "show prompt gets the correct result 3"
-gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
-	 "retrieving the prompt causes no extra prompt_hook calls 3"
-gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
-	 "prompt_hook argument is default prompt. 3"
-gdb_exit
+with_test_prefix "sync_execution = 1, is_running = 1" {
+    prompt_gdb_start
+    gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
+	".*prompt is \"$gdb_prompt \".*" \
+	"show prompt gets the correct result 3"
+    gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
+	"retrieving the prompt causes no extra prompt_hook calls 3"
+    gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
+	"prompt_hook argument is default prompt. 3"
+    gdb_exit
+}
 
 set GDBFLAGS [concat $tmp_gdbflags " -ex \"set pagination off\""]
 set GDBFLAGS [concat $GDBFLAGS " -ex \"set editing on\""]
@@ -105,15 +110,17 @@ set GDBFLAGS [concat $GDBFLAGS " -ex \"attach $testpid\""]
 set GDBFLAGS [concat $GDBFLAGS " -ex \"interrupt\""]
 
 # sync_execution = 1 is_running = 0
-prompt_gdb_start
-gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
-	 ".*prompt is \"$gdb_prompt \".*" \
-	 "show prompt gets the correct result 4"
-gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
-	 "retrieving the prompt causes no extra prompt_hook calls 4"
-gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
-	 "prompt_hook argument is default prompt. 4"
-gdb_exit
+with_test_prefix "sync_execution = 1, is_running = 0" {
+    prompt_gdb_start
+    gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
+	".*prompt is \"$gdb_prompt \".*" \
+	"show prompt gets the correct result 4"
+    gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
+	"retrieving the prompt causes no extra prompt_hook calls 4"
+    gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
+	"prompt_hook argument is default prompt. 4"
+    gdb_exit
+}
 
 set GDBFLAGS $saved_gdbflags
 kill_wait_spawned_process $test_spawn_id
-- 
2.25.4


  parent reply	other threads:[~2021-03-08 18:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 18:36 [PATCH 00/14] Resolve all duplicate test names in gdb.python/ Andrew Burgess
2021-03-08 18:36 ` [PATCH 01/14] gdb/testsuite: make test names unique in gdb.python/py-mi.exp Andrew Burgess
2021-03-08 18:36 ` [PATCH 02/14] gdb/testsuite: make test names unique in gdb.python/py-format-string.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 03/14] gdb/testsuite: make test names unique in gdb.python/py-strfns.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 04/14] gdb/testsuite: make test names unique in gdb.python/py-finish-breakpoint.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 05/14] gdb/testsuite: make test names unique in gdb.python/py-explore.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 06/14] gdb/testsuite: make test names unique in gdb.python/py-pp-maint.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 07/14] gdb/testsuite: make test names unique in gdb.python/py-block.exp Andrew Burgess
2021-03-08 18:37 ` Andrew Burgess [this message]
2021-03-08 18:37 ` [PATCH 09/14] gdb/testsuite: make test names unique in gdb.python/py-symtab.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 10/14] gdb/testsuite: remove a duplicate test Andrew Burgess
2021-03-08 18:37 ` [PATCH 11/14] gdb/testsuite: make test names unique in gdb.python/py-explore-cc.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 12/14] gdb/testsuite: check the correct Python variable in test Andrew Burgess
2021-03-08 18:37 ` [PATCH 13/14] gdb/testsuite: remove duplicate test from gdb.python/py-value-cc.exp Andrew Burgess
2021-03-08 18:37 ` [PATCH 14/14] gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp Andrew Burgess
2021-03-10 14:32 ` [PATCH 00/14] Resolve all duplicate test names in gdb.python/ Tom Tromey

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=62307ee470b6da358a83beae74e32b464b341fd3.1615228575.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@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).