gdb/testsuite: Remove duplicates from gdb.base/nested-subp2.exp
authorLancelot SIX <lsix@lancelotsix.com>
Sun, 21 Nov 2021 15:34:09 +0000 (15:34 +0000)
committerLancelot SIX <lsix@lancelotsix.com>
Fri, 7 Jan 2022 22:43:34 +0000 (22:43 +0000)
When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.base/nested-subp2.exp ...
    DUPLICATE: gdb.base/nested-subp2.exp: continue to the STOP marker
    DUPLICATE: gdb.base/nested-subp2.exp: print c
    DUPLICATE: gdb.base/nested-subp2.exp: print count

Fix by using with_test_prefix to differentiate the test that are
performed at different points during the execution of the debuggee.

Tested on x86_64-linux.

gdb/testsuite/gdb.base/nested-subp2.exp

index 3a187a53c4b5ec49b17295a5e0810c7a3f535ddc..876b797e49d6a8fea1082e69b0d4ed5c84dbf568 100644 (file)
@@ -49,21 +49,23 @@ set bp_location [gdb_get_line_number "STOP" "${testcase}.c"]
 gdb_test "break ${testcase}.c:${bp_location}" \
          "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: .*" \
          "breakpoint to the STOP marker"
-gdb_test "continue" \
-         "Breakpoint \[0-9\]+, increment .*" \
-         "continue to the STOP marker"
 
+with_test_prefix "stop at first iteration" {
+    gdb_test "continue" \
+            "Breakpoint \[0-9\]+, increment .*" \
+            "continue to the STOP marker"
 
-# Check we get correct values for both local and non-local variable references.
-
-gdb_test "print c"     "102 'f'"
-gdb_test "print count" "0"
+    # Check we get correct values for both local and non-local variable references.
+    gdb_test "print c"     "102 'f'"
+    gdb_test "print count" "0"
+}
 
 
 # Same but a little later: make sure we were looking at the proper places.
-
-gdb_test "continue" \
-         "Breakpoint \[0-9\]+, increment .*" \
-         "continue to the STOP marker"
-gdb_test "print c"     "111 'o'"
-gdb_test "print count" "1"
+with_test_prefix "stop at second iteration" {
+    gdb_test "continue" \
+            "Breakpoint \[0-9\]+, increment .*" \
+            "continue to the STOP marker"
+    gdb_test "print c"     "111 'o'"
+    gdb_test "print count" "1"
+}