binutils-gdb/gdb/testsuite/gdb.multi/hello.c
Philippe Waroquiers 80047cfc27 Fix gdb.multi/multi-arch-exec.exp blocking under high load/slow gdb
When running multi-arch-exec.exp under valgrind, the test succeeds
when the machine is not loaded, but blocks when the machine is highly
loaded (e.g. when running the testsuite with valgrind with -j X
where X is one more than the nr of available cores).

The problem is that the hello program dies too early due to the alarm (30).

So, increase the alarm timer.
Note that this does not make the test take longer (it takes about
3.5 seconds on my system).  As I understand, the alarm is just there
to avoid hello staying there forever in case of another problem.

2019-03-28  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.multi/hello.c (main): Increase alarm timer.
2019-03-28 21:15:20 +01:00

65 lines
1.2 KiB
C

/* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <unistd.h>
short hglob = 1;
short glob = 92;
void
bar()
{
if (glob == 0)
exit(1);
}
int commonfun() { bar(); } /* from hello */
int
hello(int x)
{
x *= 2;
return x + 45;
}
static void
hello_loop (void)
{
}
int
main()
{
int tmpx;
alarm (240);
bar();
tmpx = hello(glob);
commonfun();
glob = tmpx;
commonfun();
while (1)
{
hello_loop ();
usleep (20);
}
}