public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
@ 2022-01-07 22:47 Lancelot SIX
  0 siblings, 0 replies; only message in thread
From: Lancelot SIX @ 2022-01-07 22:47 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=202fb8408581fa1611d8f467c76199247b7d5a01

commit 202fb8408581fa1611d8f467c76199247b7d5a01
Author: Lancelot SIX <lsix@lancelotsix.com>
Date:   Mon Nov 22 22:36:47 2021 +0000

    gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
    
    When I run the testsuite, I have:
    
        Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
        DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
        DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
    
    Fix by grouping the various phases in with_test_prefix blocks.  Since
    the tests now have a prefix, remove the manually written prefixes in
    testnames.
    
    Also change some messages with the pattern "(timeout) $testname" into
    "$estname (timeout)" since tools will handle this as $testname[1] (which
    is what we want in this particular scenario).
    
    Tested on x86_64-linux.
    
    [1] https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages

Diff:
---
 gdb/testsuite/gdb.mi/mi-catch-load.exp | 77 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 36 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index 0f04588b905..ca2f586fae5 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -40,48 +40,53 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
     return -1
 }
 
-mi_clean_restart $binfile
-mi_runto_main
-
 # test -catch-load
-mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
-mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
-    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
-    "catch-load: catch load"
-mi_send_resuming_command "exec-continue" "catch-load: continue"
+with_test_prefix "catch-load" {
+    mi_clean_restart $binfile
+    mi_runto_main
 
-gdb_expect {
-    -re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
-        pass "catch-load: solib-event stop"
-    }
-    -re ".*$mi_gdb_prompt$" {
-	setup_kfail mi/15945 *-*-*mingw*
-        fail "catch-load: solib-event stop"
-    }
-    timeout {
-        fail "(timeout) catch-load: solib-event stop"
+    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" \
+		"auto-solib-add on"
+    mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
+		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
+		"catch load"
+    mi_send_resuming_command "exec-continue" "continue"
+
+    gdb_expect {
+	-re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
+	    pass "solib-event stop"
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    setup_kfail mi/15945 *-*-*mingw*
+	    fail "solib-event stop"
+	}
+	timeout {
+	    fail "solib-event stop (timeout)"
+	}
     }
 }
 
-mi_clean_restart $binfile
-mi_runto_main
-
 # test -catch-unload
-mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
-mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
-    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
-    "catch-unload: catch unload"
-mi_send_resuming_command "exec-continue" "catch-unload: continue"
+with_test_prefix "catch-unload" {
+    mi_clean_restart $binfile
+    mi_runto_main
 
-gdb_expect {
-    -re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
-        pass "catch-unload: solib-event stop"
-    }
-    -re ".*$mi_gdb_prompt$" {
-	setup_kfail mi/15945 *-*-*mingw*
-        fail "catch-unload: solib-event stop"
-    }
-    timeout {
-        fail "(timeout) catch-unload: solib-event stop"
+    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "auto-solib-add on"
+    mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
+		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
+		"catch unload"
+    mi_send_resuming_command "exec-continue" "continue"
+
+    gdb_expect {
+	-re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
+	    pass "solib-event stop"
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    setup_kfail mi/15945 *-*-*mingw*
+	    fail "solib-event stop"
+	}
+	timeout {
+	    fail "solib-event stop (timeout)"
+	}
     }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-07 22:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 22:47 [binutils-gdb] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp Lancelot SIX

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