public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/4] [gdb/testsuite] Fix duplicates in gdb.fortran/array-{indices,repeat}.exp
@ 2024-06-11 13:11 Tom de Vries
  2024-06-11 13:11 ` [PATCH 2/4] [gdb/testsuite] Fix duplicates in gdb.fortran/huge.exp Tom de Vries
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Tom de Vries @ 2024-06-11 13:11 UTC (permalink / raw)
  To: gdb-patches

When running test-case gdb.fortran/array-indices.exp on a system without
fortran compiler, I run into a duplicate:
...
Running /home/vries/gdb/src/gdb/testsuite/gdb.fortran/array-indices.exp ...
gdb compile failed, default_target_compile: Can't find gfortran.
UNTESTED: gdb.fortran/array-indices.exp: array-indices.exp
gdb compile failed, default_target_compile: Can't find gfortran.
UNTESTED: gdb.fortran/array-indices.exp: array-indices.exp
DUPLICATE: gdb.fortran/array-indices.exp: array-indices.exp
...

Fix this by adding a with_test_prefix at the toplevel.

Likewise in gdb.fortran/array-repeat.exp.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.fortran/array-indices.exp | 37 ++++++++++++---------
 gdb/testsuite/gdb.fortran/array-repeat.exp  | 31 ++++++++++-------
 2 files changed, 40 insertions(+), 28 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/array-indices.exp b/gdb/testsuite/gdb.fortran/array-indices.exp
index 5cfc10cb600..0fb0080639f 100644
--- a/gdb/testsuite/gdb.fortran/array-indices.exp
+++ b/gdb/testsuite/gdb.fortran/array-indices.exp
@@ -62,13 +62,13 @@ set r3p9  [string_to_regexp $a3p9]
 set rep5  "<repeats 5 times>"
 set rep6  "<repeats 6 times>"
 
-proc array_repeat { variant } {
+proc array_repeat_1 { variant } {
     global testfile srcfile
-    upvar n0 n0 n1 n1 n2 n2 n5 n5
-    upvar r1p r1p r1p9 r1p9 r2po r2po r2p9o r2p9o r2p r2p r2p9 r2p9
-    upvar r3po r3po r3p9o r3p9o r3p r3p r3p9 r3p9
-    upvar a2po a2po a2p9o a2p9o a3po a3po a3p9o a3p9o
-    upvar rep5 rep5 rep6 rep6
+    global n0 n0 n1 n1 n2 n2 n5 n5
+    global r1p r1p r1p9 r1p9 r2po r2po r2p9o r2p9o r2p r2p r2p9 r2p9
+    global r3po r3po r3p9o r3p9o r3p r3p r3p9 r3p9
+    global a2po a2po a2p9o a2p9o a3po a3po a3p9o a3p9o
+    global rep5 rep5 rep6 rep6
 
     standard_testfile "${variant}.f90"
 
@@ -77,19 +77,18 @@ proc array_repeat { variant } {
 	return -1
     }
 
-    with_test_prefix "${variant}" {
-	gdb_test_no_output "set print array-indexes on"
-    }
+    gdb_test_no_output "set print array-indexes on"
 
     if {![fortran_runto_main]} {
 	perror "Could not run to main."
 	return
     }
 
-    gdb_breakpoint [gdb_get_line_number "Break here"]
-    gdb_continue_to_breakpoint "${variant}"
+    set line_marker "Break here"
+    gdb_breakpoint [gdb_get_line_number $line_marker]
+    gdb_continue_to_breakpoint $line_marker
 
-    with_test_prefix "${variant}: repeats=unlimited, elements=unlimited" {
+    with_test_prefix "repeats=unlimited, elements=unlimited" {
 	# Check the arrays print as expected.
 	gdb_test_no_output "set print repeats unlimited"
 	gdb_test_no_output "set print elements unlimited"
@@ -102,7 +101,7 @@ proc array_repeat { variant } {
 	gdb_test "print array_3d9" "${r3p9}"
     }
 
-    with_test_prefix "${variant}: repeats=4, elements=unlimited" {
+    with_test_prefix "repeats=4, elements=unlimited" {
 	# Now set the repeat limit.
 	gdb_test_no_output "set print repeats 4"
 	gdb_test_no_output "set print elements unlimited"
@@ -126,7 +125,7 @@ proc array_repeat { variant } {
 				$n5 = ($n0 = ($n0 = 9, ${rep6}) ${rep6}))"]
     }
 
-    with_test_prefix "${variant}: repeats=unlimited, elements=12" {
+    with_test_prefix "repeats=unlimited, elements=12" {
 	# Now set the element limit.
 	gdb_test_no_output "set print repeats unlimited"
 	gdb_test_no_output "set print elements 12"
@@ -147,7 +146,7 @@ proc array_repeat { variant } {
 				...)"]
     }
 
-    with_test_prefix "${variant}: repeats=4, elements=12" {
+    with_test_prefix "repeats=4, elements=12" {
 	# Now set both limits.
 	gdb_test_no_output "set print repeats 4"
 	gdb_test_no_output "set print elements 12"
@@ -173,7 +172,7 @@ proc array_repeat { variant } {
 				       ...) ...)"]
     }
 
-    with_test_prefix "${variant}: repeats=4, elements=30" {
+    with_test_prefix "repeats=4, elements=30" {
 	# Now set both limits.
 	gdb_test_no_output "set print repeats 4"
 	gdb_test_no_output "set print elements 30"
@@ -196,5 +195,11 @@ proc array_repeat { variant } {
     }
 }
 
+proc array_repeat { variant } {
+    with_test_prefix $variant {
+	array_repeat_1 $variant
+    }
+}
+
 array_repeat "array-repeat"
 array_repeat "array-slices-repeat"
diff --git a/gdb/testsuite/gdb.fortran/array-repeat.exp b/gdb/testsuite/gdb.fortran/array-repeat.exp
index 34ea8fc19f5..1a7c013cc16 100644
--- a/gdb/testsuite/gdb.fortran/array-repeat.exp
+++ b/gdb/testsuite/gdb.fortran/array-repeat.exp
@@ -50,12 +50,12 @@ set r3p9  [string_to_regexp $a3p9]
 set rep5  "<repeats 5 times>"
 set rep6  "<repeats 6 times>"
 
-proc array_repeat { variant } {
+proc array_repeat_1 { variant } {
     global testfile srcfile binfile
-    upvar r1p r1p r1p9 r1p9 r2po r2po r2p9o r2p9o r2p r2p r2p9 r2p9
-    upvar r3po r3po r3p9o r3p9o r3p r3p r3p9 r3p9
-    upvar a2po a2po a2p9o a2p9o a3po a3po a3p9o a3p9o
-    upvar rep5 rep5 rep6 rep6
+    global r1p r1p r1p9 r1p9 r2po r2po r2p9o r2p9o r2p r2p r2p9 r2p9
+    global r3po r3po r3p9o r3p9o r3p r3p r3p9 r3p9
+    global a2po a2po a2p9o a2p9o a3po a3po a3p9o a3p9o
+    global rep5 rep5 rep6 rep6
 
     standard_testfile "${variant}.f90"
 
@@ -69,10 +69,11 @@ proc array_repeat { variant } {
 	return
     }
 
-    gdb_breakpoint [gdb_get_line_number "Break here"]
-    gdb_continue_to_breakpoint "${variant}"
+    set line_marker "Break here"
+    gdb_breakpoint [gdb_get_line_number $line_marker]
+    gdb_continue_to_breakpoint $line_marker
 
-    with_test_prefix "${variant}: repeats=unlimited, elements=unlimited" {
+    with_test_prefix "repeats=unlimited, elements=unlimited" {
 	# Check the arrays print as expected.
 	gdb_test_no_output "set print repeats unlimited"
 	gdb_test_no_output "set print elements unlimited"
@@ -85,7 +86,7 @@ proc array_repeat { variant } {
 	gdb_test "print array_3d9" "${r3p9}"
     }
 
-    with_test_prefix "${variant}: repeats=4, elements=unlimited" {
+    with_test_prefix "repeats=4, elements=unlimited" {
 	# Now set the repeat limit.
 	gdb_test_no_output "set print repeats 4"
 	gdb_test_no_output "set print elements unlimited"
@@ -105,7 +106,7 @@ proc array_repeat { variant } {
 				((9, ${rep6}) ${rep6}))"]
     }
 
-    with_test_prefix "${variant}: repeats=unlimited, elements=12" {
+    with_test_prefix "repeats=unlimited, elements=12" {
 	# Now set the element limit.
 	gdb_test_no_output "set print repeats unlimited"
 	gdb_test_no_output "set print elements 12"
@@ -122,7 +123,7 @@ proc array_repeat { variant } {
 	    [string_to_regexp "((${a3p9o} ${a3p9o} ...) ...)"]
     }
 
-    with_test_prefix "${variant}: repeats=4, elements=12" {
+    with_test_prefix "repeats=4, elements=12" {
 	# Now set both limits.
 	gdb_test_no_output "set print repeats 4"
 	gdb_test_no_output "set print elements 12"
@@ -142,7 +143,7 @@ proc array_repeat { variant } {
 	    [string_to_regexp "(((3, ${rep5}, 9) (3, ${rep5}, 9) ...) ...)"]
     }
 
-    with_test_prefix "${variant}: repeats=4, elements=30" {
+    with_test_prefix "repeats=4, elements=30" {
 	# Now set both limits.
 	gdb_test_no_output "set print repeats 4"
 	gdb_test_no_output "set print elements 30"
@@ -163,5 +164,11 @@ proc array_repeat { variant } {
     }
 }
 
+proc array_repeat { variant } {
+    with_test_prefix $variant {
+	array_repeat_1 $variant
+    }
+}
+
 array_repeat "array-repeat"
 array_repeat "array-slices-repeat"

base-commit: 9dc9a56ebc902df4b34cda404da3f3062e9af616
-- 
2.35.3


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

end of thread, other threads:[~2024-06-20 13:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11 13:11 [PATCH 1/4] [gdb/testsuite] Fix duplicates in gdb.fortran/array-{indices,repeat}.exp Tom de Vries
2024-06-11 13:11 ` [PATCH 2/4] [gdb/testsuite] Fix duplicates in gdb.fortran/huge.exp Tom de Vries
2024-06-20 13:40   ` Tom de Vries
2024-06-11 13:11 ` [PATCH 3/4] [gdb/testsuite] Fix duplicates in gdb.opt/inline-cmds.exp Tom de Vries
2024-06-11 13:11 ` [PATCH 4/4] [gdb/testsuite] Fix duplicates in gdb.base/watchpoint-unaligned.exp Tom de Vries
2024-06-17  9:00 ` [PATCH 1/4] [gdb/testsuite] Fix duplicates in gdb.fortran/array-{indices, repeat}.exp Alexandra Petlanova Hajkova
2024-06-17 21:26   ` 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).