[PATCH 25/29] gdb/testsuite: Remove duplicates from gdb.base/pointers.exp
Lancelot SIX
lsix@lancelotsix.com
Fri Dec 17 23:14:13 GMT 2021
>
> Hmm, how about this instead?
>
> with_test_prefix "post-increment" {
> gdb_test_no_output "set variable y = *v_int_pointer++" \
> "pointer dereference, set variable"
> gdb_test "print y" " = 6" "pointer assignment"
> gdb_test "print *v_int_pointer" " = 18" "pointer increment"
> }
>
> with_test_prefix "pre-decrement" {
> gdb_test_no_output "set variable y = *--v_int_pointer2" \
> "pointer dereference, set variable"
> gdb_test "print y" " = 6" "pointer assignment"
> gdb_test "print *v_int_pointer2" " = 6" "pointer decrement"
> }
Done in the wollowing patch.
Lancelot.
---
>From 08d05cebf6b40b64834d1d2a140ca6a9a99be8ae Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Sun, 21 Nov 2021 01:55:43 +0000
Subject: [PATCH] gdb/testsuite: Remove duplicates from gdb.base/pointers.exp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
---
gdb/testsuite/gdb.base/pointers.exp | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index fa7531d0f85..0ac0465072f 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -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" \
--
2.34.0
More information about the Gdb-patches
mailing list