From: Doug Evans <dje@google.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Don't run forever in gdb.base/structs.c
Date: Wed, 01 Oct 2014 21:02:00 -0000 [thread overview]
Message-ID: <yjt2d2abqz9x.fsf@ruffy.mtv.corp.google.com> (raw)
Hi.
If gdb crashes during testing tests may be left to free-run, eating cpu.
This patch fixes one of the more egregious cases since several versions
of the program are built.
I've got patches to fix others.
Just seeing if folks want to comment on this first.
IWBN to have the harness itself cleanup, and I think there's something
we can do there, but that's not always robust either, and I think
multiple levels of robustness would be useful.
Since this testcase is an egregious one, and since this patch simple,
I'm starting with this.
I thought of trying to make the loop limit something less random,
but that itself introduces complications, e.g., if one wants to extend
the test. So I kept it simple.
One could instead reorganize the test, but it's not worth it,
at least not at this point.
2014-10-01 Doug Evans <dje@google.com>
* gdb.base/structs.c (main): Don't run forever.
diff --git a/gdb/testsuite/gdb.base/structs.c b/gdb/testsuite/gdb.base/structs.c
index 60772bb..d0b69a8 100644
--- a/gdb/testsuite/gdb.base/structs.c
+++ b/gdb/testsuite/gdb.base/structs.c
@@ -425,12 +425,14 @@ int main()
Fun17(foo17);
Fun18(foo18);
- /* An infinite loop that first clears all the variables and then
+ /* An (almost-)infinite loop that first clears all the variables and then
calls each function. This "hack" is to make testing random
functions easier - "advance funN" is guaranteed to have always
- been preceded by a global variable clearing zed call. */
+ been preceded by a global variable clearing zed call.
+ We don't let this run forever in case gdb crashes while testing,
+ we don't want to be left eating all cpu on the user's system. */
- while (1)
+ for (i = 0; i < 1000000; ++i)
{
zed ();
L1 = fun1();
next reply other threads:[~2014-10-01 21:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 21:02 Doug Evans [this message]
2014-10-01 23:51 ` Pedro Alves
2014-10-02 20:10 ` Doug Evans
2014-10-03 8:57 ` Pedro Alves
2014-10-27 19:32 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yjt2d2abqz9x.fsf@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox