public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH v2 15/17] fix some "exec" tests
Date: Fri, 18 Oct 2013 20:49:00 -0000	[thread overview]
Message-ID: <1382129374-18344-16-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1382129374-18344-1-git-send-email-tromey@redhat.com>

A few tests run an inferior that execs some other inferior.  These
tests have the correct file name 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.

	* 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.
---
 gdb/testsuite/gdb.base/foll-exec.c          | 12 ++++++------
 gdb/testsuite/gdb.base/foll-exec.exp        |  8 ++++++--
 gdb/testsuite/gdb.base/foll-vfork.c         |  2 +-
 gdb/testsuite/gdb.base/foll-vfork.exp       |  8 ++++++--
 gdb/testsuite/gdb.multi/bkpt-multi-exec.c   |  4 ++--
 gdb/testsuite/gdb.multi/bkpt-multi-exec.exp |  8 ++++++--
 6 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/gdb/testsuite/gdb.base/foll-exec.c b/gdb/testsuite/gdb.base/foll-exec.c
index 1b76090..78c1cda 100644
--- a/gdb/testsuite/gdb.base/foll-exec.c
+++ b/gdb/testsuite/gdb.base/foll-exec.c
@@ -17,27 +17,27 @@ main ()
 
   printf ("foll-exec is about to execlp(execd-prog)...\n");
 
-  execlp ("gdb.base/execd-prog",
-          "gdb.base/execd-prog",
+  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 ("gdb.base/execd-prog",
-         "gdb.base/execd-prog",
+  execl (BASEDIR "/execd-prog",
+         BASEDIR "/execd-prog",
          "execl arg1 from foll-exec",
          "execl arg2 from foll-exec",
          (char *)0);
 
   {
     static char * argv[] = {
-      (char *)"gdb.base/execd-prog",
+      (char *)BASEDIR "/execd-prog",
       (char *)"execv arg1 from foll-exec",
       (char *)0};
 
     printf ("foll-exec is about to execv(execd-prog)...\n");
 
-    execv ("gdb.base/execd-prog", argv);
+    execv (BASEDIR "/execd-prog", argv);
   }
 }
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 9456f42..135cad6 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -29,13 +29,17 @@ set testfile2 "execd-prog"
 set srcfile2 ${testfile2}.c
 set binfile2 [standard_output_file ${testfile2}]
 
+set compile_options debug
+set dirname [relative_filename [pwd] [file dirname $binfile]]
+lappend compile_options "additional_flags=-DBASEDIR=\"$dirname\""
+
 # build the first test case
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $compile_options] != "" } {
      untested foll-exec.exp
      return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } {
      untested foll-exec.exp
      return -1
 }
diff --git a/gdb/testsuite/gdb.base/foll-vfork.c b/gdb/testsuite/gdb.base/foll-vfork.c
index 694843f..d7d72fd 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.c
+++ b/gdb/testsuite/gdb.base/foll-vfork.c
@@ -29,7 +29,7 @@ main ()
   pid = vfork ();
   if (pid == 0) {
     printf ("I'm the child!\n");
-    execlp ("gdb.base/vforked-prog", "gdb.base/vforked-prog", (char *)0);
+    execlp (BASEDIR "/vforked-prog", BASEDIR "/vforked-prog", (char *)0);
     perror ("exec failed");
     _exit (1);
   }
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 0660060..29d6da0 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -47,7 +47,11 @@ if [istarget "hppa*-hp-hpux10.20"] then {
 
 standard_testfile
 
-if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
+set compile_options debug
+set dirname [relative_filename [pwd] [file dirname $binfile]]
+lappend compile_options "additional_flags=-DBASEDIR=\"$dirname\""
+
+if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} {
     untested "failed to compile $testfile"
     return -1
 }
@@ -55,7 +59,7 @@ if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
 set testfile2 "vforked-prog"
 set srcfile2 ${testfile2}.c
 
-if {[build_executable $testfile.exp $testfile2 $srcfile2 {debug}] == -1} {
+if {[build_executable $testfile.exp $testfile2 $srcfile2 $compile_options] == -1} {
     untested "failed to compile $testfile2"
     return -1
 }
diff --git a/gdb/testsuite/gdb.multi/bkpt-multi-exec.c b/gdb/testsuite/gdb.multi/bkpt-multi-exec.c
index 672d63b..94c9668 100644
--- a/gdb/testsuite/gdb.multi/bkpt-multi-exec.c
+++ b/gdb/testsuite/gdb.multi/bkpt-multi-exec.c
@@ -7,7 +7,7 @@ int main (void)
 {
   printf ("foll-exec is about to execl(crashme)...\n");
 
-  execl ("gdb.multi/crashme",
-         "gdb.multi/crashme",
+  execl (BASEDIR "/crashme",
+         BASEDIR "/crashme",
          (char *)0);
 }
diff --git a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
index cf74701..c4eee8f 100644
--- a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
+++ b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
@@ -33,11 +33,15 @@ set exec2 "crashme"
 set srcfile2 ${exec2}.c
 set binfile2 [standard_output_file ${exec2}]
 
-if { [build_executable ${testfile}.exp ${exec1} "${srcfile1}" {debug nowarnings}] == -1 } {
+set compile_options {debug nowarnings}
+set dirname [relative_filename [pwd] [file dirname $binfile1]]
+lappend compile_options "additional_flags=-DBASEDIR=\"$dirname\""
+
+if { [build_executable ${testfile}.exp ${exec1} "${srcfile1}" $compile_options] == -1 } {
     return -1
 }
 
-if { [build_executable ${testfile}.exp ${exec2} "${srcfile2}" {debug nowarnings}] == -1 } {
+if { [build_executable ${testfile}.exp ${exec2} "${srcfile2}" $compile_options] == -1 } {
     return -1
 }
 
-- 
1.8.1.4

  parent reply	other threads:[~2013-10-18 20:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 20:49 [PATCH v2 00/17] test suite parallel safety Tom Tromey
2013-10-18 20:49 ` [PATCH v2 02/17] fix some simple thinkos in the test suite Tom Tromey
2013-10-18 20:49 ` [PATCH v2 01/17] fix up log-file toggling Tom Tromey
2013-10-18 20:49 ` [PATCH v2 08/17] simple changes in gdb.base Tom Tromey
2013-10-18 20:49 ` Tom Tromey [this message]
2013-10-25 16:21   ` [PATCH v2 15/17] fix some "exec" tests Pedro Alves
2013-10-25 16:39     ` Tom Tromey
2013-10-25 17:02       ` Pedro Alves
2013-10-18 20:49 ` [PATCH v2 09/17] update checkpoint test Tom Tromey
2013-10-18 20:49 ` [PATCH v2 06/17] fix up gdb.mi Tom Tromey
2013-10-18 20:49 ` [PATCH v2 12/17] fix up gdb.server Tom Tromey
2013-10-18 20:49 ` [PATCH v2 07/17] fix up gdb.trace Tom Tromey
2013-10-25 16:22   ` Pedro Alves
2013-10-25 16:37     ` Tom Tromey
2013-10-18 20:49 ` [PATCH v2 03/17] fix weird.exp for parallel testing Tom Tromey
2013-10-18 21:00 ` [PATCH v2 11/17] introduce relative_filename and use it Tom Tromey
2013-10-25 16:22   ` Pedro Alves
2013-10-25 16:42     ` Tom Tromey
2013-10-25 17:03       ` Pedro Alves
2013-10-28 19:01   ` Doug Evans
2013-10-28 20:10     ` Tom Tromey
2013-10-18 21:00 ` [PATCH v2 14/17] fix argv0-symlink.exp for parallel mode Tom Tromey
2013-10-18 21:11 ` [PATCH v2 17/17] switch to fully " Tom Tromey
2013-10-18 21:24 ` [PATCH v2 13/17] make gdb.asm parallel-safe Tom Tromey
2013-10-18 21:24 ` [PATCH v2 10/17] update fileio test Tom Tromey
2013-10-18 21:36 ` [PATCH v2 04/17] fix up gdb.gdb Tom Tromey
2013-10-18 21:36 ` [PATCH v2 05/17] fix up gdb.xml Tom Tromey
2013-10-25 16:21   ` Pedro Alves
2013-10-25 18:23     ` Tom Tromey
2013-10-18 21:44 ` [PATCH v2 16/17] fix some fission tests Tom Tromey
2013-10-25 16:23 ` [PATCH v2 00/17] test suite parallel safety Pedro Alves

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=1382129374-18344-16-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).