old-cross-binutils/gdb/testsuite/gdb.base/foll-exec.c
Tom Tromey 3fef966c5f fix some "exec" tests
A few tests run an inferior that execs some other program.  The name
of this exec'd program is compiled in.  These tests assume the current
test suite directory layout, but fail in parallel mode.

This patch fixes these tests by letting the .exp files pass in the
directory names at compile time.

2013-11-04  Tom Tromey  <tromey@redhat.com>

	* gdb.base/foll-exec.c (main): Use BASEDIR.
	* gdb.base/foll-exec.exp: Define BASEDIR during compilation.
	* gdb.base/foll-vfork.c (main): Use BASEDIR.
	* gdb.base/foll-vfork.exp: Define BASEDIR during compilation.
	* gdb.multi/bkpt-multi-exec.c (main): Use BASEDIR.
	* gdb.multi/bkpt-multi-exec.exp: Define BASEDIR during compilation.
2013-11-04 11:02:10 -07:00

43 lines
871 B
C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int global_i = 100;
#ifdef PROTOTYPES
int main (void)
#else
main ()
#endif
{
int local_j = global_i+1;
int local_k = local_j+1;
printf ("foll-exec is about to execlp(execd-prog)...\n");
execlp (BASEDIR "/execd-prog",
BASEDIR "/execd-prog",
"execlp arg1 from foll-exec",
(char *)0);
printf ("foll-exec is about to execl(execd-prog)...\n");
execl (BASEDIR "/execd-prog",
BASEDIR "/execd-prog",
"execl arg1 from foll-exec",
"execl arg2 from foll-exec",
(char *)0);
{
static char * argv[] = {
(char *)BASEDIR "/execd-prog",
(char *)"execv arg1 from foll-exec",
(char *)0};
printf ("foll-exec is about to execv(execd-prog)...\n");
execv (BASEDIR "/execd-prog", argv);
}
}