aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-03-08 18:01:21 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-03-12 12:18:33 +0000
commite3e48d8fdb4f9874b0a297530e29c151ed991021 (patch)
tree572566a870773e9de6592ab199e6973d2a023fff
parent2cb60e747bc546e3f7b49c928b2a99cbfdb16206 (diff)
downloadgdb-e3e48d8fdb4f9874b0a297530e29c151ed991021.zip
gdb-e3e48d8fdb4f9874b0a297530e29c151ed991021.tar.gz
gdb-e3e48d8fdb4f9874b0a297530e29c151ed991021.tar.bz2
gdb/testsuite: make test names unique in gdb.python/py-prompt.exp
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.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.python/py-prompt.exp85
2 files changed, 51 insertions, 39 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7ee89f1..6e74c5b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2021-03-12 Andrew Burgess <andrew.burgess@embecosm.com>
+ * gdb.python/py-prompt.exp: Add with_test_prefix to make test
+ names unique.
+
+2021-03-12 Andrew Burgess <andrew.burgess@embecosm.com>
+
* gdb.python/py-block.exp: Give tests unique names.
2021-03-12 Andrew Burgess <andrew.burgess@embecosm.com>
diff --git a/gdb/testsuite/gdb.python/py-prompt.exp b/gdb/testsuite/gdb.python/py-prompt.exp
index 6eed715..d030ef6 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