This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Eliminate some sleep usage.
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 13 Mar 2009 14:20:32 +0300
- Subject: Eliminate some sleep usage.
Some time ago, to fix flakiness of mi-simplerun.exp, I've checked in
this patch:
http://sourceware.org/ml/gdb-patches/2008-06/msg00243.html
There were some concerns about the use of sleep function at the patch,
but they were not found to be critical. Unfortunately, I've missed
the fact that sleep is not available on many embedded targets, which
makes MI testsuite mostly useless for them. This patch implement
alternative approach -- it turns out nothing actually checks that
print prints anything, so we can use dummy function to eliminate
printf without disturbing the testsuite too much.
Tested for {sync,async}x{native,gdbserver} and checked in.
Index: gdb/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1826
diff -u -p -r1.1826 ChangeLog
--- gdb/testsuite/ChangeLog 13 Mar 2009 10:55:08 -0000 1.1826
+++ gdb/testsuite/ChangeLog 13 Mar 2009 11:16:36 -0000
@@ -1,5 +1,15 @@
2009-03-13 Vladimir Prus <vladimir@codesourcery.com>
+ Eliminate some sleep usage.
+
+ * gdb.mi/basics.c (do_nothing): New.
+ (main): Use do_nothing instead of printf, so that
+ not to introduce race condition between output of
+ inferiour and output of gdb. Do not use sleep as it
+ is not generally available on embedded targets.
+
+2009-03-13 Vladimir Prus <vladimir@codesourcery.com>
+
* gdb.mi/mi-cli.exp: Adjust for output difference in
sync and async modes.
Index: gdb/testsuite/gdb.mi/basics.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/basics.c,v
retrieving revision 1.14
diff -u -p -r1.14 basics.c
--- gdb/testsuite/gdb.mi/basics.c 3 Jan 2009 05:58:05 -0000 1.14
+++ gdb/testsuite/gdb.mi/basics.c 13 Mar 2009 11:16:36 -0000
@@ -57,13 +57,16 @@ int return_1 ()
return 1;
}
+void do_nothing (void)
+{
+}
+
main ()
{
callee1 (2, "A string argument.", 3.5);
callee1 (2, "A string argument.", 3.5);
- sleep (1);
- printf ("Hello, World!");
+ do_nothing (); /* Hello, World! */
callme (1);
callme (2);