* [commit] Robustify mi-simplerun.
@ 2008-06-13 20:10 Vladimir Prus
2008-06-13 20:13 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Prus @ 2008-06-13 20:10 UTC (permalink / raw)
To: gdb-patches
The program been run by this testcase produces output. Since GDB prints
the *running notification, and the prompt, after actually resuming the program,
there's a race condition -- the program may produce the output before gdb prints
the prompt, which breaks the test. This patch add artificial delay to the
program to make sure gdb print the prompt first.
Checked in.
- Volodya
[testsuite]
* gdb.mi/basics.c (main): Add a call to sleep.
* gdb.mi/mi-cli.exp: Adjust for change in line numbers.
* gdb.mi/mi2-cli.exp: Likewise.
* gdb.mi/mi-break.exp: Likewise.
---
gdb/testsuite/gdb.mi/basics.c | 9 ++-------
gdb/testsuite/gdb.mi/mi-break.exp | 2 +-
gdb/testsuite/gdb.mi/mi-cli.exp | 2 +-
gdb/testsuite/gdb.mi/mi2-cli.exp | 2 +-
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.mi/basics.c b/gdb/testsuite/gdb.mi/basics.c
index e4be7b2..43e1816 100644
--- a/gdb/testsuite/gdb.mi/basics.c
+++ b/gdb/testsuite/gdb.mi/basics.c
@@ -21,6 +21,7 @@
*/
#include <stdio.h>
+#include <unistd.h>
int callee4 (void)
{
@@ -61,6 +62,7 @@ main ()
callee1 (2, "A string argument.", 3.5);
callee1 (2, "A string argument.", 3.5);
+ sleep (1);
printf ("Hello, World!");
callme (1);
@@ -68,10 +70,3 @@ main ()
return 0;
}
-
-/*
-Local variables:
-change-log-default-name: "ChangeLog-mi"
-End:
-*/
-
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index b3fc551..2776fda 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -158,7 +158,7 @@ proc test_ignore_count {} {
mi_run_cmd
- mi_expect_stop "breakpoint-hit" "callme" "\{name=\"i\",value=\"2\"\}" ".*basics.c" "51" \
+ mi_expect_stop "breakpoint-hit" "callme" "\{name=\"i\",value=\"2\"\}" ".*basics.c" "52" \
{"" "disp=\"keep\"" } "run to breakpoint with ignore count"
}
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index c488449..37c484b 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -96,7 +96,7 @@ mi_gdb_test "-interpreter-exec console \"list\"" \
".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
"-interpreter-exec console \"list\""
-mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "27" \
+mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "28" \
{ "" "disp=\"keep\"" } "continue to callee4"
# NOTE: cagney/2003-02-03: Not yet.
diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp
index d9e3467..0f5a771 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi2-cli.exp
@@ -96,7 +96,7 @@ mi_gdb_test "-interpreter-exec console \"list\"" \
".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
"-interpreter-exec console \"list\""
-mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "27" \
+mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "28" \
{ "" "disp=\"keep\"" } \
"continue to callee4"
--
1.5.3.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] Robustify mi-simplerun.
2008-06-13 20:10 [commit] Robustify mi-simplerun Vladimir Prus
@ 2008-06-13 20:13 ` Daniel Jacobowitz
2008-06-13 21:08 ` Vladimir Prus
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-06-13 20:13 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb-patches
On Fri, Jun 13, 2008 at 11:55:42PM +0400, Vladimir Prus wrote:
> The program been run by this testcase produces output. Since GDB prints
> the *running notification, and the prompt, after actually resuming the program,
> there's a race condition -- the program may produce the output before gdb prints
> the prompt, which breaks the test. This patch add artificial delay to the
> program to make sure gdb print the prompt first.
Is the output necessary for any test? If not, can we just remove it?
Sleep is bad. Someone'll run the testsuite on a machine with load
(e.g. our nightly tester) and it'll fail again.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] Robustify mi-simplerun.
2008-06-13 20:13 ` Daniel Jacobowitz
@ 2008-06-13 21:08 ` Vladimir Prus
2008-06-13 21:13 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Prus @ 2008-06-13 21:08 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Saturday 14 June 2008 00:00:35 Daniel Jacobowitz wrote:
> On Fri, Jun 13, 2008 at 11:55:42PM +0400, Vladimir Prus wrote:
> > The program been run by this testcase produces output. Since GDB prints
> > the *running notification, and the prompt, after actually resuming the program,
> > there's a race condition -- the program may produce the output before gdb prints
> > the prompt, which breaks the test. This patch add artificial delay to the
> > program to make sure gdb print the prompt first.
>
> Is the output necessary for any test? If not, can we just remove it?
> Sleep is bad. Someone'll run the testsuite on a machine with load
> (e.g. our nightly tester) and it'll fail again.
I cannot find any evidence that the output is directly tested for. There are
some tests that rely on the presence of the code statements that produce
this output, so just removing those prints will be more work.
Do you actually think high load will break this? Essentially, we only need
gdb to grab a single slice of processor time before the debugged program gets to
printing, and I'd expect it will, during that second.
- Volodya
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] Robustify mi-simplerun.
2008-06-13 21:08 ` Vladimir Prus
@ 2008-06-13 21:13 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-06-13 21:13 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb-patches
On Sat, Jun 14, 2008 at 12:10:04AM +0400, Vladimir Prus wrote:
> Do you actually think high load will break this? Essentially, we only need
> gdb to grab a single slice of processor time before the debugged program gets to
> printing, and I'd expect it will, during that second.
We can come back to it later then, if it actually causes a problem.
Or if I get annoyed at the one-second pause... not likely :-)
(The worst offender is completion.exp, which sleeps a lot more than
one second.)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-13 20:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-13 20:10 [commit] Robustify mi-simplerun Vladimir Prus
2008-06-13 20:13 ` Daniel Jacobowitz
2008-06-13 21:08 ` Vladimir Prus
2008-06-13 21:13 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox