public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 1/2] [gdb/testsuite] Use proc readnow in two test-cases
@ 2023-07-22  9:00 Tom de Vries
  2023-07-22  9:00 ` [pushed 2/2] [gdb/testsuite] Improve gdb.arch/arm-pthread_cond_timedwait-bt.exp Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2023-07-22  9:00 UTC (permalink / raw)
  To: gdb-patches

Use "require !readnow" in two test-cases, instead of the written-out variant.

Tested on x86_64-linux, with target boards unix and readnow.
---
 .../gdb.arch/arm-pthread_cond_timedwait-bt.exp        | 11 ++++-------
 gdb/testsuite/gdb.base/readnever.exp                  | 11 ++++-------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
index 0cf7f273b39..17f8d68b847 100644
--- a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
+++ b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
@@ -17,6 +17,10 @@
 # syscall is active. But some active syscalls keep PC pointing to the SVC
 # instruction itself.
 
+# See if we have target board readnow.exp or similar.  We're using
+# --readnever, which is not allowed in combination with --readnow.
+require !readnow
+
 standard_testfile
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
@@ -24,13 +28,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
     return
 }
 
-# See if we have target board readnow.exp or similar.
-if { [lsearch -exact $GDBFLAGS -readnow] != -1 \
-         || [lsearch -exact $GDBFLAGS --readnow] != -1 } {
-    untested "--readnever not allowed in combination with --readnow"
-    return -1
-}
-
 save_vars { GDBFLAGS } {
     append GDBFLAGS " --readnever"
     if { [clean_restart ${binfile}] == -1 } {
diff --git a/gdb/testsuite/gdb.base/readnever.exp b/gdb/testsuite/gdb.base/readnever.exp
index 765b5bda062..8a21c4117d0 100644
--- a/gdb/testsuite/gdb.base/readnever.exp
+++ b/gdb/testsuite/gdb.base/readnever.exp
@@ -13,6 +13,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# See if we have target board readnow.exp or similar.  We're using
+# --readnever, which is not allowed in combination with --readnow.
+require !readnow
+
 standard_testfile .c
 
 if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } {
@@ -20,13 +24,6 @@ if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } {
     return -1
 }
 
-# See if we have target board readnow.exp or similar.
-if { [lsearch -exact $GDBFLAGS -readnow] != -1 \
-	 || [lsearch -exact $GDBFLAGS --readnow] != -1 } {
-    untested "--readnever not allowed in combination with --readnow"
-    return -1
-}
-
 save_vars { GDBFLAGS } {
     append GDBFLAGS " --readnever"
     if { [clean_restart ${binfile}] == -1 } {

base-commit: 6fbe38ce1170415bc1d2fe596911a056091949de
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pushed 2/2] [gdb/testsuite] Improve gdb.arch/arm-pthread_cond_timedwait-bt.exp
  2023-07-22  9:00 [pushed 1/2] [gdb/testsuite] Use proc readnow in two test-cases Tom de Vries
@ 2023-07-22  9:00 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2023-07-22  9:00 UTC (permalink / raw)
  To: gdb-patches

I noticed in test-case gdb.arch/arm-pthread_cond_timedwait-bt.exp that
prepare_for_testing is used, followed by a clean_restart.

This calls clean_restart twice in a row.

Fix this by using build_executable instead.

Also, I noticed that the test-case requires an SVC instruction, so add a
require to limit the test-case to supported architectures.

While we're at it, run M-x indent-region in emacs to fix indentation.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
index 17f8d68b847..e64fa46ef4f 100644
--- a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
+++ b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
@@ -17,21 +17,24 @@
 # syscall is active. But some active syscalls keep PC pointing to the SVC
 # instruction itself.
 
+# Require an architecture with the SVC instruction.
+require {is_any_target "aarch64*-*-*" "arm*-*-*"}
+
 # See if we have target board readnow.exp or similar.  We're using
 # --readnever, which is not allowed in combination with --readnow.
 require !readnow
 
 standard_testfile
 
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
-			  {debug pthreads}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
+	  {debug pthreads}] } {
     return
 }
 
 save_vars { GDBFLAGS } {
     append GDBFLAGS " --readnever"
     if { [clean_restart ${binfile}] == -1 } {
-       return -1
+	return -1
     }
 }
 
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-22  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-22  9:00 [pushed 1/2] [gdb/testsuite] Use proc readnow in two test-cases Tom de Vries
2023-07-22  9:00 ` [pushed 2/2] [gdb/testsuite] Improve gdb.arch/arm-pthread_cond_timedwait-bt.exp Tom de Vries

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).