From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 26/27] Use clean_restart in gdb.python
Date: Wed, 25 Jan 2023 15:46:13 -0700 [thread overview]
Message-ID: <20230125224614.1006886-27-tom@tromey.com> (raw)
In-Reply-To: <20230125224614.1006886-1-tom@tromey.com>
Change gdb.python to use clean_restart more consistently.
---
gdb/testsuite/gdb.python/py-format-string.exp | 5 +----
gdb/testsuite/gdb.python/py-function.exp | 6 +-----
gdb/testsuite/gdb.python/py-lookup-type.exp | 4 +---
gdb/testsuite/gdb.python/py-prettyprint.exp | 11 ++---------
gdb/testsuite/gdb.python/py-progspace.exp | 6 +-----
gdb/testsuite/gdb.python/py-section-script.exp | 10 ++--------
gdb/testsuite/gdb.python/py-template.exp | 6 +-----
gdb/testsuite/gdb.python/py-type.exp | 7 +------
gdb/testsuite/gdb.python/python.exp | 5 +----
9 files changed, 11 insertions(+), 49 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index f343ce31a46..1d50f59dee3 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -47,10 +47,7 @@ proc build_inferior {exefile lang} {
proc prepare_gdb {exefile} {
global srcdir subdir srcfile testfile hex
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart $exefile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp
index 25b83a797aa..3a6e30259fd 100644
--- a/gdb/testsuite/gdb.python/py-function.exp
+++ b/gdb/testsuite/gdb.python/py-function.exp
@@ -20,11 +20,7 @@ load_lib gdb-python.exp
require allow_python_tests
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test_multiline "input convenience function" \
"python" "" \
diff --git a/gdb/testsuite/gdb.python/py-lookup-type.exp b/gdb/testsuite/gdb.python/py-lookup-type.exp
index c914ea1068b..63f603cc009 100644
--- a/gdb/testsuite/gdb.python/py-lookup-type.exp
+++ b/gdb/testsuite/gdb.python/py-lookup-type.exp
@@ -25,9 +25,7 @@ require allow_python_tests
# created by each language since GDB. So, we must start GDB without
# loading any symbol in.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
proc test_lookup_type { lang type_name } {
gdb_test_no_output "set language ${lang}"
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 674a4edd0d2..b7661ff14ed 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -36,10 +36,7 @@ proc run_lang_tests {exefile lang} {
set nl "\[\r\n\]+"
# Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart $exefile
if {![runto_main]} {
return
@@ -190,11 +187,7 @@ with_test_prefix c++ {
# Run various other tests.
-# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp
index c7be9489601..638b27927c6 100644
--- a/gdb/testsuite/gdb.python/py-progspace.exp
+++ b/gdb/testsuite/gdb.python/py-progspace.exp
@@ -26,11 +26,7 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
gdb_test "python print (gdb.current_progspace().filename)" "None" \
"current progspace filename (None)"
diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index 24d207416af..fec7b007317 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -46,11 +46,7 @@ if {[build_executable $testfile.exp $testfile $srcfile \
return -1
}
-# Start with a fresh gdb.
-gdb_exit
-gdb_start
-
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Try first with a restrictive safe-path.
@@ -71,9 +67,7 @@ gdb_test_multiple "info auto-load python-scripts" "$test_name" {
# Try again with a working safe-path.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
# Get the name of the binfile on the host; on a remote host this means
# stripping off any directory prefix.
diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp
index a89a813578d..9bc392dcb8d 100644
--- a/gdb/testsuite/gdb.python/py-template.exp
+++ b/gdb/testsuite/gdb.python/py-template.exp
@@ -25,11 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
proc test_template_arg {exefile type} {
global testfile srcdir subdir srcfile
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index e7837d7405f..c245d41a1ac 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -34,12 +34,7 @@ proc build_inferior {exefile lang} {
# Restart GDB.
proc restart_gdb {exefile} {
- global srcdir subdir srcfile testfile hex
-
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${exefile}
+ clean_restart $exefile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index b8a4718ef6c..8fe119fead1 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -25,10 +25,7 @@ if {[build_executable $testfile.exp $testfile \
return -1
}
-# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart
set remote_source2_py [gdb_remote_download host \
${srcdir}/${subdir}/source2.py]
--
2.39.1
next prev parent reply other threads:[~2023-01-25 22:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 22:45 [PATCH 00/27] Many small testsuite cleanups Tom Tromey
2023-01-25 22:45 ` [PATCH 01/27] Use ordinary calling convention for clean_restart Tom Tromey
2023-01-25 22:45 ` [PATCH 02/27] Use clean_restart in gdb.dlang Tom Tromey
2023-01-25 22:45 ` [PATCH 03/27] Eliminate spurious returns from the test suite Tom Tromey
2023-01-25 22:45 ` [PATCH 04/27] Remove some dead code in gdb.fortran/info-types.exp Tom Tromey
2023-01-25 22:45 ` [PATCH 05/27] Minor "require" fixups Tom Tromey
2023-01-25 22:45 ` [PATCH 06/27] Remove unnecessary call to standard_testfile Tom Tromey
2023-01-25 22:45 ` [PATCH 07/27] Start gdb after building executable in mi-basics.exp Tom Tromey
2023-01-25 22:45 ` [PATCH 08/27] Use mi_clean_restart more Tom Tromey
2023-01-25 22:45 ` [PATCH 09/27] Use clean_restart in gdb.pascal Tom Tromey
2023-01-25 22:45 ` [PATCH 10/27] Use clean_restart in gdb.linespec Tom Tromey
2023-01-25 22:45 ` [PATCH 11/27] Use clean_restart in gdb.opencl Tom Tromey
2023-01-25 22:45 ` [PATCH 12/27] Use clean_restart in gdb.trace Tom Tromey
2023-01-26 17:34 ` Pedro Alves
2023-01-26 18:34 ` Tom Tromey
2023-01-27 0:36 ` Tom Tromey
2023-01-25 22:46 ` [PATCH 13/27] Use clean_restart in gdb.objc Tom Tromey
2023-01-25 22:46 ` [PATCH 14/27] Use clean_restart in gdb.threads Tom Tromey
2023-01-25 22:46 ` [PATCH 15/27] Use clean_restart in gdb.guile Tom Tromey
2023-01-25 22:46 ` [PATCH 16/27] Use clean_restart in gdb.arch Tom Tromey
2023-01-25 22:46 ` [PATCH 17/27] Use clean_restart in gdb.reverse Tom Tromey
2023-01-25 22:46 ` [PATCH 18/27] Use clean_restart in gdb.dwarf2 Tom Tromey
2023-01-25 22:46 ` [PATCH 19/27] Use clean_restart in gdb.ada Tom Tromey
2023-01-25 22:46 ` [PATCH 20/27] Use clean_restart in gdb.fortran Tom Tromey
2023-01-25 22:46 ` [PATCH 21/27] Use clean_restart in gdb.stabs Tom Tromey
2023-01-25 22:46 ` [PATCH 22/27] Use clean_restart in gdb.go Tom Tromey
2023-01-25 22:46 ` [PATCH 23/27] Use clean_restart in gdb.perf Tom Tromey
2023-01-25 22:46 ` [PATCH 24/27] Use clean_restart in gdb.disasm Tom Tromey
2023-01-25 22:46 ` [PATCH 25/27] Use clean_restart in gdb.cp Tom Tromey
2023-01-25 22:46 ` Tom Tromey [this message]
2023-01-25 22:46 ` [PATCH 27/27] Use clean_restart in gdb.base Tom Tromey
2023-01-26 17:37 ` [PATCH 00/27] Many small testsuite cleanups Pedro Alves
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=20230125224614.1006886-27-tom@tromey.com \
--to=tom@tromey.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).