gdb/testsuite: Remove duplicates from gdb.base/pointers.exp
authorLancelot SIX <lsix@lancelotsix.com>
Sun, 21 Nov 2021 01:55:43 +0000 (01:55 +0000)
committerLancelot SIX <lsix@lancelotsix.com>
Fri, 7 Jan 2022 22:43:34 +0000 (22:43 +0000)
When I run the testsuite, I have :

    Running .../gdb/testsuite/gdb.base/pointers.exp ...
    DUPLICATE: gdb.base/pointers.exp: pointer assignment

Fix by placing the sections with duplication in with_test_prefix blocks.
This removes the duplication and gives a better organization the file.

Tested on x86_64-linux.
Co-Authored-By: Pedro Alves <pedro@palves.net>
gdb/testsuite/gdb.base/pointers.exp

index 8a26c54851505c75e004e4e39524c96a72f72b48..bca8377637b5fd8e59b33f1ace08780fe5f4f4fb 100644 (file)
@@ -145,18 +145,20 @@ gdb_test "print v_int_pointer < v_int_pointer2" " = $true" \
 gdb_test "print v_int_pointer > v_int_pointer2" " = $false" \
     "pointer1>pointer2"
 
-gdb_test_no_output "set variable y = *v_int_pointer++" \
-    "set y = *v_int_pointer++"
-gdb_test "print y" " = 6" "pointer assignment"
-gdb_test "print *v_int_pointer" " = 18" "and post-increment"
-
-
+with_test_prefix "post-increment" {
+    gdb_test_no_output "set variable y = *v_int_pointer++" \
+       "set y = *v_int_pointer++"
+    gdb_test "print y" " = 6" "pointer assignment"
+    gdb_test "print *v_int_pointer" " = 18" "and post-increment"
+}
 
-gdb_test_no_output "set variable y = *--v_int_pointer2" \
-    "set y = *--v_int_pointer2"
-gdb_test "print y" " = 6" "pointer assignment"
-gdb_test "print *v_int_pointer2" " = 6" "and pre-decrement"
 
+with_test_prefix "pre-decrement" {
+    gdb_test_no_output "set variable y = *--v_int_pointer2" \
+       "set y = *--v_int_pointer2"
+    gdb_test "print y" " = 6" "pointer assignment"
+    gdb_test "print *v_int_pointer2" " = 6" "and pre-decrement"
+}
 
 
 gdb_test_no_output "set variable y =v_int_pointer-v_int_pointer2" \