public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/testsuite: add max number of instructions check in gdb.base/unwind-on-each-insn.exp
@ 2022-10-22  4:04 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-10-22  4:04 UTC (permalink / raw)
  To: gdb-cvs

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

commit 49c843e6d2d0577200e7c1d2d02855f21a3a9dde
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Oct 21 23:58:15 2022 -0400

    gdb/testsuite: add max number of instructions check in gdb.base/unwind-on-each-insn.exp
    
    This test sends my CI in an infinite loop of failures.   We expect to
    have a handful of iterations (5 on my development machine, where the
    test passes fine)but the log shows that it went up to 104340 iterations:
    
        FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: maint print frame-id
        DUPLICATE: gdb.base/unwind-on-each-insn.exp - instruction 104340: maint print frame-id
        FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: [string equal $fid $main_fid]
        FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: get hexadecimal valueof "$pc"
    
    Add a max instruction check, exit the loop if we reach 100 iterations.
    This should allow the test to fail fast if there's a problem, but 100
    iterations should be more than enough for when things are working.
    
    Change-Id: I77978d593aca046068f9209272d82e1675ba17c2

Diff:
---
 gdb/testsuite/gdb.base/unwind-on-each-insn.exp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp
index 46bea800c1b..faa6a1a3f06 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp
@@ -149,6 +149,13 @@ for { set i_count 1 } { true } { incr i_count } {
 	    break
 	}
 
+	if { $i_count > 100 } {
+	    # We expect a handful of instructions, if we reach 100,
+	    # something is going wrong.  Avoid an infinite loop.
+	    fail "exceeded max number of instructions"
+	    break
+	}
+
 	gdb_test "stepi" ".*"
     }
 }

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

only message in thread, other threads:[~2022-10-22  4:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  4:04 [binutils-gdb] gdb/testsuite: add max number of instructions check in gdb.base/unwind-on-each-insn.exp Simon Marchi

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