public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 04/13] fix up gdb.gdb
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
  2013-08-23 20:36 ` [PATCH 06/13] fix up gdb.mi Tom Tromey
@ 2013-08-23 20:36 ` Tom Tromey
  2013-08-23 20:37 ` [PATCH 07/13] fix up gdb.trace Tom Tromey
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes the gdb.gdb tests to be parallel-safe, by ensuring that the
new "xgdb" file ends up in the standard output directory during the
tests.

	* gdb.gdb/selftest.exp: Use standard_output_file.
	* lib/selftest-support.exp (do_self_tests): Use
	standard_output_file.
---
 gdb/testsuite/gdb.gdb/selftest.exp     | 10 ++++++++--
 gdb/testsuite/lib/selftest-support.exp | 10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index d700715..3f934cf 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -479,11 +479,17 @@ proc test_with_self { executable } {
 
 set GDB_FULLPATH [find_gdb $GDB]
 
+if {[is_remote host]} {
+    set xgdb x$tool
+} else {
+    set xgdb [standard_output_file x$tool]
+}
+
 # Remove any old copy lying around.
-remote_file host delete x$tool
+remote_file host delete $xgdb
 
 gdb_start
-set file [remote_download host $GDB_FULLPATH x$tool]
+set file [remote_download host $GDB_FULLPATH $xgdb]
 set result [test_with_self $file]
 gdb_exit
 catch "remote_file host delete $file"
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index fc4bccc..98a83aa 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -129,11 +129,17 @@ proc do_self_tests {function body} {
 
     set GDB_FULLPATH [find_gdb $GDB]
 
+    if {[is_remote host]} {
+	set xgdb x$tool
+    } else {
+	set xgdb [standard_output_file x$tool]
+    }
+
     # Remove any old copy lying around.
-    remote_file host delete x$tool
+    remote_file host delete $xgdb
 
     gdb_start
-    set file [remote_download host $GDB_FULLPATH x$tool]
+    set file [remote_download host $GDB_FULLPATH $xgdb]
 
     set result [selftest_setup $file $function]
     if {$result == 0} then {
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 06/13] fix up gdb.mi
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
@ 2013-08-23 20:36 ` Tom Tromey
  2013-08-25  1:50   ` Yao Qi
  2013-08-23 20:36 ` [PATCH 04/13] fix up gdb.gdb Tom Tromey
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes gdb.mi to be parallel-safe.

	* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
	Use "dwarf2 always-disassemble" for the "maint set" test.
	* gdb.mi/mi-file-transfer.exp (test_file_transfer): Use
	standard_output_file.
	* gdb.mi/mi-logging.exp: Use standard_output_file.
---
 gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp |  6 +++---
 gdb/testsuite/gdb.mi/mi-file-transfer.exp     | 22 +++++++++++++++-------
 gdb/testsuite/gdb.mi/mi-logging.exp           |  2 +-
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
index 1791c97..7ba8724 100644
--- a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
@@ -85,9 +85,9 @@ proc test_command_param_changed { } {
 
 	# No notification is emitted for 'maint set' commands.
 	foreach boolean_opt { "on" "off" } {
-	    mi_gdb_test "maint set profile ${boolean_opt}" \
-		"\\&\"maint set profile ${boolean_opt}\\\\n\"\r\n\\^done" \
-		"\"maint set profile ${boolean_opt}\""
+	    mi_gdb_test "maint set dwarf2 always-disassemble ${boolean_opt}" \
+		"\\&\"maint set dwarf2 always-disassemble ${boolean_opt}\\\\n\"\r\n\\^done" \
+		"\"maint dwarf2 always-disassemble ${boolean_opt}\""
 	}
 
 	# Full command parameters are included in the notification when a
diff --git a/gdb/testsuite/gdb.mi/mi-file-transfer.exp b/gdb/testsuite/gdb.mi/mi-file-transfer.exp
index 9229fde..edf1786 100644
--- a/gdb/testsuite/gdb.mi/mi-file-transfer.exp
+++ b/gdb/testsuite/gdb.mi/mi-file-transfer.exp
@@ -54,15 +54,23 @@ proc mi_gdbserver_run { } {
 }
 
 proc test_file_transfer { filename description } {
-    mi_gdb_test "-target-file-put \"$filename\" \"down-server\"" \
+    if {![is_remote host] && ![is_remote target]} {
+	set up_server [standard_output_file up-server]
+	set down_server [standard_output_file down-server]
+    } else {
+	set up_server up-server
+	set down_server down-server
+    }
+
+    mi_gdb_test "-target-file-put \"$filename\" \"${down_server}\"" \
 	"\\^done" "put $description"
-    mi_gdb_test "-target-file-get \"down-server\" \"up-server\"" \
+    mi_gdb_test "-target-file-get \"${down_server}\" \"${up_server}\"" \
 	"\\^done" "get $description"
 
     if { ![is_remote target] } {
 	# If we can check the target copy of the file, do that too.
 	# This should catch symmetric errors in upload and download.
-	set result [remote_exec host "cmp -s $filename down-server"]
+	set result [remote_exec host "cmp -s $filename ${down_server}"]
 	if { [lindex $result 0] == 0 } {
 	    pass "compare intermediate $description"
 	} else {
@@ -70,25 +78,25 @@ proc test_file_transfer { filename description } {
 	}
     }
 
-    set result [remote_exec host "cmp -s $filename up-server"]
+    set result [remote_exec host "cmp -s $filename ${up_server}"]
     if { [lindex $result 0] == 0 } {
 	pass "compare $description"
     } else {
 	fail "compare $description"
     }
 
-    mi_gdb_test "-target-file-delete \"down-server\"" \
+    mi_gdb_test "-target-file-delete \"${down_server}\"" \
 	"\\^done" "deleted $description"
 
     if { ![is_remote target] } {
-	if { ! [remote_file target exists down-server] } {
+	if { ! [remote_file target exists ${down_server}] } {
 	    pass "verified deleted $description"
 	} else {
 	    fail "verified deleted $description"
 	}
     }
 
-    catch { file delete up-server }
+    catch { file delete ${up_server} }
 }
 
 mi_gdbserver_run
diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp
index 87f3e1b..b38c036 100644
--- a/gdb/testsuite/gdb.mi/mi-logging.exp
+++ b/gdb/testsuite/gdb.mi/mi-logging.exp
@@ -33,7 +33,7 @@ if {[mi_run_to_main] < 0} {
     return -1
 }
 
-set milogfile "milog.txt"
+set milogfile [standard_output_file "milog.txt"]
 
 mi_gdb_test "-gdb-set logging file $milogfile" ".*"
 
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 00/13] test suite parallel safety
@ 2013-08-23 20:36 Tom Tromey
  2013-08-23 20:36 ` [PATCH 06/13] fix up gdb.mi Tom Tromey
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:36 UTC (permalink / raw)
  To: gdb-patches

This is the final series to make the test suite parallel-safe.  As a
reminder, here parallel safety just means that a given test will not
write (or delete) files outside of the subdirectory assigned by the
gdb test harness.

Even after this series there are stragglers:

First, I only seriously tried this on a single architecture.  So,
there are bound to be issues for other arches.  These are generally
easy to fix; and, if you have inotifytools easy to diagnose as well.
I'll work on this as time permits.  I think this is less serious than
it may sound, as there aren't really that many arch-specific tests
that are likely to have clashes.


Second, Fortran:

    Running ../../../archer/gdb/testsuite/gdb.fortran/library-module.exp ...
    ./ CREATE lib.mod0
    ./ DELETE lib.mod0
    ./ CREATE libmany.mod0
    ./ DELETE libmany.mod0
    Running ../../../archer/gdb/testsuite/gdb.fortran/module.exp ...
    ./ CREATE mod1.mod0
    ./ DELETE mod1.mod0
    ./ CREATE mod2.mod0
    ./ DELETE mod2.mod0
    ./ CREATE modmany.mod0
    ./ DELETE modmany.mod0
    ./ CREATE moduse.mod0
    ./ DELETE moduse.mod0

This happens because the compiler generates these files.  I don't know
of a good, portable (across Fortran compilers) way to fix this.

This is only an issue in practice if we have multiple Fortran modules
with the same name.


And, finally:

    Running ../../../archer/gdb/testsuite/gdb.trace/save-trace.exp ...
    ./ CREATE savetrace.tr
    ./ DELETE savetrace.tr

This is a test for a directory-less save.  It seemed wrong to change
it.


I regression tested this series on x86-64 Fedora 18, both with
GDB_PARALLEL set and without.


After this series, I think we're ready to enable the new parallel
code.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 03/13] fix weird.exp for parallel testing
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (7 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 11/13] introduce relative_filename and use it Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-23 20:37 ` [PATCH 02/13] fix some simple thinkos in the test suite Tom Tromey
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes up gdb.stabs/weird.exp for parallel testing.  This just
means using gdb_remote_download and standard_output_file, so that the
tests end up in the right place.

	* gdb.stabs/weird.exp: Use gdb_remote_download and
	standard_output_file.
---
 gdb/testsuite/gdb.stabs/weird.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index bf0fdba..64e6082 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -292,7 +292,8 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-set binfile [remote_download host ${binfile} object.o]
+set binfile [gdb_remote_download host ${binfile} \
+		 [standard_output_file object.o]]
 send_gdb "file $binfile\n"
 # If $binfile is very long, a \r (but not a \n) will echo in the
 # middle of the echo of the command.  So to match the echo, we
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 12/13] fix up gdb.server
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (2 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 07/13] fix up gdb.trace Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-23 20:37 ` [PATCH 13/13] make gdb.asm parallel-safe Tom Tromey
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes gdb.server to be parallel-safe.

	* gdb.server/file-transfer.exp: Use standard_output_file.
---
 gdb/testsuite/gdb.server/file-transfer.exp | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.server/file-transfer.exp b/gdb/testsuite/gdb.server/file-transfer.exp
index aa56380..841d757 100644
--- a/gdb/testsuite/gdb.server/file-transfer.exp
+++ b/gdb/testsuite/gdb.server/file-transfer.exp
@@ -35,15 +35,22 @@ gdb_test "disconnect" ".*"
 gdbserver_run ""
 
 proc test_file_transfer { filename description } {
-    gdb_test "remote put \"$filename\" down-server" \
+    set up_server up-server
+    set down_server down-server
+    if {![is_remote host] && ![is_remote target]} {
+	set up_server [standard_output_file $up_server]
+	set down_server [standard_output_file $down_server]
+    }
+
+    gdb_test "remote put \"$filename\" $down_server" \
 	"Successfully sent .*" "put $description"
-    gdb_test "remote get down-server up-server" \
+    gdb_test "remote get $down_server $up_server" \
 	"Successfully fetched .*" "get $description"
 
     if { ![is_remote target] } {
 	# If we can check the target copy of the file, do that too.
 	# This should catch symmetric errors in upload and download.
-	set result [remote_exec host "cmp -s $filename down-server"]
+	set result [remote_exec host "cmp -s $filename $down_server"]
 	if { [lindex $result 0] == 0 } {
 	    pass "compare intermediate $description"
 	} else {
@@ -51,25 +58,25 @@ proc test_file_transfer { filename description } {
 	}
     }
 
-    set result [remote_exec host "cmp -s $filename up-server"]
+    set result [remote_exec host "cmp -s $filename $up_server"]
     if { [lindex $result 0] == 0 } {
 	pass "compare $description"
     } else {
 	fail "compare $description"
     }
 
-    gdb_test "remote delete down-server" \
+    gdb_test "remote delete $down_server" \
 	"Successfully deleted .*" "deleted $description"
 
     if { ![is_remote target] } {
-	if { ! [remote_file target exists down-server] } {
+	if { ! [remote_file target exists $down_server] } {
 	    pass "verified deleted $description"
 	} else {
 	    fail "verified deleted $description"
 	}
     }
 
-    catch { file delete up-server }
+    catch { file delete $up_server }
 }
 
 test_file_transfer "$binfile" "binary file"
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 10/13] update fileio test
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (11 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 08/13] simple changes in gdb.base Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-27 14:01 ` [PATCH 00/13] test suite parallel safety Pedro Alves
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This updates the fileio test to be parallel-safe.

	* gdb.base/fileio.c (test_open, test_write, test_read)
	(test_lseek, test_close, test_stat, test_fstat)
	(test_isatty, test_system, test_rename, test_unlink):
	Use OUTDIR define.
	* gdb.base/fileio.exp: Define OUTDIR during compilation.
	Use standard_output_file.
---
 gdb/testsuite/gdb.base/fileio.c   | 54 ++++++++++++++++++++-------------------
 gdb/testsuite/gdb.base/fileio.exp | 24 ++++++++++-------
 2 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
index 329522f..4926c05 100644
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -58,6 +58,7 @@ system (const char * string);
 1) Invalid string/command. -  returns 127.  */
 static const char *strerrno (int err);
 
+/* Note that OUTDIR is defined by the test suite.  */
 #define FILENAME    "foo.fileio.test"
 #define RENAMED     "bar.fileio.test"
 #define NONEXISTANT "nofoo.fileio.test"
@@ -77,7 +78,7 @@ test_open ()
 
   /* Test opening */
   errno = 0;
-  ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR);
+  ret = open (OUTDIR FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR);
   printf ("open 1: ret = %d, errno = %d %s\n", ret, errno,
 	  ret >= 0 ? "OK" : "");
   
@@ -86,7 +87,7 @@ test_open ()
   stop ();
   /* Creating an already existing file (created by fileio.exp) */
   errno = 0;
-  ret = open (FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR);
+  ret = open (OUTDIR FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR);
   printf ("open 2: ret = %d, errno = %d %s\n", ret, errno,
 	  strerrno (errno));
   if (ret >= 0)
@@ -110,13 +111,13 @@ test_open ()
   stop ();
   /* Open for write but no write permission */
   errno = 0;
-  ret = open (NOWRITE, O_CREAT | O_RDONLY, S_IRUSR);
+  ret = open (OUTDIR NOWRITE, O_CREAT | O_RDONLY, S_IRUSR);
   if (ret >= 0)
     {
       close (ret);
       stop ();
       errno = 0;
-      ret = open (NOWRITE, O_WRONLY);
+      ret = open (OUTDIR NOWRITE, O_WRONLY);
       printf ("open 5: ret = %d, errno = %d %s\n", ret, errno,
 	      strerrno (errno));
       if (ret >= 0)
@@ -137,7 +138,7 @@ test_write ()
 
   /* Test writing */
   errno = 0;
-  fd = open (FILENAME, O_WRONLY);
+  fd = open (OUTDIR FILENAME, O_WRONLY);
   if (fd >= 0)
     {
       errno = 0;
@@ -157,7 +158,7 @@ test_write ()
   stop ();
   /* Write to a read-only file */
   errno = 0;
-  fd = open (FILENAME, O_RDONLY);
+  fd = open (OUTDIR FILENAME, O_RDONLY);
   if (fd >= 0)
     {
       errno = 0;
@@ -178,7 +179,7 @@ test_read ()
 
   /* Test reading */
   errno = 0;
-  fd = open (FILENAME, O_RDONLY);
+  fd = open (OUTDIR FILENAME, O_RDONLY);
   if (fd >= 0)
     {
       memset (buf, 0, 16);
@@ -210,7 +211,7 @@ test_lseek ()
 
   /* Test seeking */
   errno = 0;
-  fd = open (FILENAME, O_RDONLY);
+  fd = open (OUTDIR FILENAME, O_RDONLY);
   if (fd >= 0)
     {
       errno = 0;
@@ -251,7 +252,7 @@ test_close ()
 
   /* Test close */
   errno = 0;
-  fd = open (FILENAME, O_RDONLY);
+  fd = open (OUTDIR FILENAME, O_RDONLY);
   if (fd >= 0)
     {
       errno = 0;
@@ -278,7 +279,7 @@ test_stat ()
 
   /* Test stat */
   errno = 0;
-  ret = stat (FILENAME, &st);
+  ret = stat (OUTDIR FILENAME, &st);
   if (!ret)
     printf ("stat 1: ret = %d, errno = %d %s\n", ret, errno,
 	    st.st_size == 11 ? "OK" : "");
@@ -313,7 +314,7 @@ test_fstat ()
 
   /* Test fstat */
   errno = 0;
-  fd = open (FILENAME, O_RDONLY);
+  fd = open (OUTDIR FILENAME, O_RDONLY);
   if (fd >= 0)
     {
       errno = 0;
@@ -352,7 +353,7 @@ test_isatty ()
   printf ("isatty 4: invalid %s\n", isatty (999) ? "yes" : "no OK");
   stop ();
   /* Check open file */
-  fd = open (FILENAME, O_RDONLY);
+  fd = open (OUTDIR FILENAME, O_RDONLY);
   if (fd >= 0)
     {
       printf ("isatty 5: file %s\n", isatty (fd) ? "yes" : "no OK");
@@ -364,6 +365,8 @@ test_isatty ()
 }
 
 
+char sys[1512];
+
 int
 test_system ()
 {
@@ -371,14 +374,13 @@ test_system ()
    * Requires test framework to switch on "set remote system-call-allowed 1"
    */
   int ret;
-  char sys[512];
 
   /* Test for shell */
   ret = system (NULL);
   printf ("system 1: ret = %d %s\n", ret, ret != 0 ? "OK" : "");
   stop ();
   /* This test prepares the directory for test_rename() */
-  sprintf (sys, "mkdir -p %s %s", TESTSUBDIR, TESTDIR2);
+  sprintf (sys, "mkdir -p %s/%s %s/%s", OUTDIR, TESTSUBDIR, OUTDIR, TESTDIR2);
   ret = system (sys);
   if (ret == 127)
     printf ("system 2: ret = %d /bin/sh unavailable???\n", ret);
@@ -399,7 +401,7 @@ test_rename ()
 
   /* Test rename */
   errno = 0;
-  ret = rename (FILENAME, RENAMED);
+  ret = rename (OUTDIR FILENAME, OUTDIR RENAMED);
   if (!ret)
     {
       errno = 0;
@@ -407,7 +409,7 @@ test_rename ()
       if (ret && errno == ENOENT)
         {
 	  errno = 0;
-	  ret = stat (RENAMED, &st);
+	  ret = stat (OUTDIR RENAMED, &st);
 	  printf ("rename 1: ret = %d, errno = %d %s\n", ret, errno,
 		  strerrno (errno));
 	  errno = 0;
@@ -420,50 +422,50 @@ test_rename ()
   stop ();
   /* newpath is existing directory, oldpath is not a directory */
   errno = 0;
-  ret = rename (RENAMED, TESTDIR2);
+  ret = rename (OUTDIR RENAMED, OUTDIR TESTDIR2);
   printf ("rename 2: ret = %d, errno = %d %s\n", ret, errno,
 	  strerrno (errno));
   stop ();
   /* newpath is a non-empty directory */
   errno = 0;
-  ret = rename (TESTDIR2, TESTDIR1);
+  ret = rename (OUTDIR TESTDIR2, OUTDIR TESTDIR1);
   printf ("rename 3: ret = %d, errno = %d %s\n", ret, errno,
           strerrno (errno));
   stop ();
   /* newpath is a subdirectory of old path */
   errno = 0;
-  ret = rename (TESTDIR1, TESTSUBDIR);
+  ret = rename (OUTDIR TESTDIR1, OUTDIR TESTSUBDIR);
   printf ("rename 4: ret = %d, errno = %d %s\n", ret, errno,
 	  strerrno (errno));
   stop ();
   /* oldpath does not exist */
   errno = 0;
-  ret = rename (NONEXISTANT, FILENAME);
+  ret = rename (OUTDIR NONEXISTANT, OUTDIR FILENAME);
   printf ("rename 5: ret = %d, errno = %d %s\n", ret, errno,
 	  strerrno (errno));
   stop ();
 }
 
+char name[1256];
+
 int
 test_unlink ()
 {
   int ret;
-  char name[256];
-  char sys[512];
 
   /* Test unlink */
   errno = 0;
-  ret = unlink (RENAMED);
+  ret = unlink (OUTDIR RENAMED);
   printf ("unlink 1: ret = %d, errno = %d %s\n", ret, errno,
 	  strerrno (errno));
   stop ();
   /* No write access */
-  sprintf (name, "%s/%s", TESTDIR2, FILENAME);
+  sprintf (name, "%s/%s/%s", OUTDIR, TESTDIR2, FILENAME);
   errno = 0;
   ret = open (name, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR);
   if (ret >= 0)
     {
-      sprintf (sys, "chmod -w %s", TESTDIR2);
+      sprintf (sys, "chmod -w %s/%s", OUTDIR, TESTDIR2);
       ret = system (sys);
       if (!ret)
         {
@@ -480,7 +482,7 @@ test_unlink ()
   stop ();
   /* pathname doesn't exist */
   errno = 0;
-  ret = unlink (NONEXISTANT);
+  ret = unlink (OUTDIR NONEXISTANT);
   printf ("unlink 3: ret = %d, errno = %d %s\n", ret, errno,
           strerrno (errno));
   stop ();
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index ded043f..b9dfb38 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -23,7 +23,15 @@ if [target_info exists gdb,nofileio] {
 
 standard_testfile
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if {[is_remote host]} {
+    set outdir .
+} else {
+    set outdir [standard_output_file {}]
+}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+	   executable \
+	   [list debug "additional_flags=-DOUTDIR=\"$outdir/\""]] != "" } {
     untested fileio.exp
     return -1
 }
@@ -35,8 +43,11 @@ if [get_compiler_info] {
     return -1
 }
 
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
+set dir2 [standard_output_file dir2.fileio.test]
+if {[file exists $dir2] && ![file writable $dir2]} {
+    system "chmod +w $dir2"
+}
+system "rm -rf [standard_output_file *.fileio.test]"
 
 set oldtimeout $timeout
 set timeout [expr "$timeout + 60"]
@@ -78,7 +89,7 @@ gdb_test continue \
 
 gdb_test "continue" ".*" ""
 
-catch "system \"chmod -f -w nowrt.fileio.test\""
+catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
 
 gdb_test continue \
 "Continuing\\..*open 5:.*EACCES$stop_msg" \
@@ -241,11 +252,6 @@ gdb_test continue \
 "Time(2) returns feasible values"
 
 gdb_exit
-# Wait till GDB really exits.
-sleep 1
-
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
 
 set timeout $oldtimeout
 return 0
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/13] fix up log-file toggling
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (9 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 02/13] fix some simple thinkos in the test suite Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-23 20:37 ` [PATCH 08/13] simple changes in gdb.base Tom Tromey
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Currently a proc in gdb.exp toggles the expect (and thus dejagnu)
logging.  This is not a super idea, but it is there to avoid putting
some preprocessor output into the log.

In the right circumstances, this can result in the log file being
mysteriously truncated.  I think this happens because it doesn't
necessarily write to the correct log file again.

The fix is to use "log_file -info" to save the previous log file.

	* lib/gdb.exp (get_compiler_info): Use log_file -info and
	restore from that.
---
 gdb/testsuite/lib/gdb.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f1f56a6..25a91dd 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2406,6 +2406,7 @@ proc get_compiler_info {{arg ""}} {
 
     # Run $ifile through the right preprocessor.
     # Toggle gdb.log to keep the compiler output out of the log.
+    set saved_log [log_file -info]
     log_file
     if [is_remote host] {
 	# We have to use -E and -o together, despite the comments
@@ -2418,7 +2419,7 @@ proc get_compiler_info {{arg ""}} {
     } else {
 	set cppout [ gdb_compile "${ifile}" "" preprocess [list "$arg" quiet] ]
     }
-    log_file -a "$outdir/$tool.log" 
+    eval log_file $saved_log
 
     # Eval the output.
     set unknown 0
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 11/13] introduce relative_filename and use it
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (6 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 09/13] update checkpoint test Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-27 13:44   ` Pedro Alves
  2013-08-23 20:37 ` [PATCH 03/13] fix weird.exp for parallel testing Tom Tromey
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This introduces a new relative_filename proc to gdb.exp and changes
some tests to use it.  This helps make these tests parallel-safe.

	* gdb.base/fullname.exp: Use standard_output_file,
	relative_filename.
	* gdb.base/hashline1.exp: Use standard_testfile,
	standard_output_file, relative_filename, clean_restart.
	* gdb.base/hashline2.exp: Use standard_testfile,
	standard_output_file, relative_filename.
	* gdb.base/hashline3.exp: Use standard_testfile,
	standard_output_file, relative_filename.
	* lib/gdb.exp (relative_filename): New proc.
---
 gdb/testsuite/gdb.base/fullname.exp  |  5 +++--
 gdb/testsuite/gdb.base/hashline1.exp | 21 +++++++++------------
 gdb/testsuite/gdb.base/hashline2.exp | 13 ++++++-------
 gdb/testsuite/gdb.base/hashline3.exp | 14 +++++++-------
 gdb/testsuite/lib/gdb.exp            | 10 ++++++++++
 5 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index 32f6ea4..2754f59 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -70,7 +70,8 @@ if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}]
 }
 
 # Build the test executable using a relative path.
-if  { [gdb_compile "${subdir}/tmp-${srcfile}" "${binfile}" executable {debug}] != "" } {
+if  { [gdb_compile [relative_filename [pwd] [standard_output_file tmp-${srcfile}]] \
+	   "${binfile}" executable {debug}] != "" } {
     return -1
 }
 
@@ -99,7 +100,7 @@ if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}]
 # we'll run GDB from.
 
 set save_pwd [pwd]
-cd ${subdir}
+cd [standard_output_file {}]
 if  { [gdb_compile [standard_output_file tmp-${srcfile}] "${testfile}" \
 	   executable {debug}] != "" } {
     cd $save_pwd
diff --git a/gdb/testsuite/gdb.base/hashline1.exp b/gdb/testsuite/gdb.base/hashline1.exp
index 950d67e..2330daf 100644
--- a/gdb/testsuite/gdb.base/hashline1.exp
+++ b/gdb/testsuite/gdb.base/hashline1.exp
@@ -21,28 +21,25 @@
 # srcfile is in objdir because we need to machine generate it in order
 # to get the correct path in the #line directive.
 
-set testfile "hashline1"
-set srcfile "${testfile}.c"
-set binfile "${objdir}/${subdir}/${testfile}"
+standard_testfile .c
 
-set fd [open ${objdir}/${subdir}/${srcfile} w]
-puts $fd "#line 2 \"[pwd]/${subdir}/${srcfile}\""
+set new_srcfile [standard_output_file $srcfile]
+set fd [open $new_srcfile w]
+puts $fd "#line 2 \"$new_srcfile\""
 puts $fd "int main () { return 0; } /* set breakpoint here */"
 close $fd
 
 # The choice of path name for the source file is important in order to trigger
-# the bug.  Using ${objdir}/${subdir}/${srcfile} here won't trigger the bug.
-if { [gdb_compile "./${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+# the bug.  Using $new_srcfile here won't trigger the bug.
+set compile_name [relative_filename $objdir $new_srcfile]
+if { [gdb_compile $compile_name "${binfile}" executable {debug}] != "" } {
     untested hashline1.exp
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
-set bp_location [gdb_get_line_number "set breakpoint here" ${objdir}/${subdir}/${srcfile}]
+set bp_location [gdb_get_line_number "set breakpoint here" $new_srcfile]
 
 # Try to set a breakpoint on the specified file location.
 
diff --git a/gdb/testsuite/gdb.base/hashline2.exp b/gdb/testsuite/gdb.base/hashline2.exp
index d7ee4a7..cd748ca 100644
--- a/gdb/testsuite/gdb.base/hashline2.exp
+++ b/gdb/testsuite/gdb.base/hashline2.exp
@@ -21,16 +21,15 @@
 # srcfile is in objdir because we need to machine generate it in order
 # to get the correct path in the #line directive.
 
-set testfile "hashline2"
-set srcfile "${testfile}.c"
-set binfile "${objdir}/${subdir}/${testfile}"
+standard_testfile .c
 
-set fd [open ${objdir}/${subdir}/${srcfile} w]
-puts $fd "#line 2 \"///[pwd]/${subdir}/${srcfile}\""
+set new_srcfile [standard_output_file $srcfile]
+set fd [open $new_srcfile w]
+puts $fd "#line 2 \"///${new_srcfile}\""
 puts $fd "int main () { return 0; } /* set breakpoint here */"
 close $fd
 
-if { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if { [gdb_compile $new_srcfile "${binfile}" executable {debug}] != "" } {
     untested hashline2.exp
     return -1
 }
@@ -40,7 +39,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-set bp_location [gdb_get_line_number "set breakpoint here" ${objdir}/${subdir}/${srcfile}]
+set bp_location [gdb_get_line_number "set breakpoint here" ${new_srcfile}]
 
 # Try to set a breakpoint on the specified file location.
 
diff --git a/gdb/testsuite/gdb.base/hashline3.exp b/gdb/testsuite/gdb.base/hashline3.exp
index 2496b3c..eba5f77 100644
--- a/gdb/testsuite/gdb.base/hashline3.exp
+++ b/gdb/testsuite/gdb.base/hashline3.exp
@@ -21,16 +21,16 @@
 # srcfile is in objdir because we need to machine generate it in order
 # to get the correct path in the #line directive.
 
-set testfile "hashline3"
-set srcfile "${testfile}.c"
-set binfile "${objdir}/${subdir}/${testfile}"
+standard_testfile
 
-set fd [open ${objdir}/${subdir}/${srcfile} w]
-puts $fd "#line 2 \"./${subdir}/${srcfile}\""
+set new_srcfile [standard_output_file $srcfile]
+set fd [open $new_srcfile w]
+set relative [relative_filename $objdir $new_srcfile]
+puts $fd "#line 2 \"./$relative\""
 puts $fd "int main () { return 0; } /* set breakpoint here */"
 close $fd
 
-if { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if { [gdb_compile $new_srcfile "${binfile}" executable {debug}] != "" } {
     untested hashline3.exp
     return -1
 }
@@ -40,7 +40,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-set bp_location [gdb_get_line_number "set breakpoint here" ${objdir}/${subdir}/${srcfile}]
+set bp_location [gdb_get_line_number "set breakpoint here" $new_srcfile]
 
 # Try to set a breakpoint on the specified file location.
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 25a91dd..8e83d8e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4306,6 +4306,16 @@ proc set_remotetimeout { timeout } {
     }
 }
 
+# ROOT and FULL are file names.  Returns the relative path from ROOT
+# to FULL.  Note that FULL must be in a subdirectory of ROOT.
+# For example, given ROOT = /usr/bin and FULL = /usr/bin/ls, this
+# will return "ls".
+
+proc relative_filename {root full} {
+    set len [llength [file split $root]]
+    return [eval file join [lrange [file split $full] $len end]]
+}
+
 # Log gdb command line and script if requested.
 if {[info exists TRANSCRIPT]} {
   rename send_gdb real_send_gdb
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 05/13] fix up gdb.xml
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (4 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 13/13] make gdb.asm parallel-safe Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-27 12:12   ` Pedro Alves
  2013-08-23 20:37 ` [PATCH 09/13] update checkpoint test Tom Tromey
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes the gdb.xml tests to be parallel-safe.

	* gdb.xml/tdesc-arch.exp: Use standard_output_file.  Make
	downloads conditional on remote host.
	(set_arch): Likewise.
	* gdb.xml/tdesc-regs.exp: Use gdb_remote_download.
	(load_description): Use standard_output_file.  Add "should_cd"
	argument.
---
 gdb/testsuite/gdb.xml/tdesc-arch.exp | 28 ++++++++++++++++------------
 gdb/testsuite/gdb.xml/tdesc-regs.exp | 34 ++++++++++++++++++++++++----------
 2 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
index 5fde2ff..be0b9f1 100644
--- a/gdb/testsuite/gdb.xml/tdesc-arch.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp
@@ -60,17 +60,20 @@ proc set_arch { arch which } {
     global gdb_prompt
     global subdir
 
-    set fd [open "$subdir/tdesc-arch.xml" w]
+    set filename [standard_output_file tdesc-arch.xml]
+    set fd [open $filename w]
     puts $fd \
 	"<target>
 	    <architecture>$arch</architecture>
 	 </target>"
     close $fd
-    remote_download host "${subdir}/tdesc-arch.xml" "tdesc-arch.xml"
+    if {[is_remote host]} {
+	set filename [remote_download host $filename tdesc-arch.xml]
+    }
 
     # Anchor the test output, so that error messages are detected.
-    set cmd "set tdesc filename tdesc-arch.xml"
-    set msg "$cmd ($which architecture)"
+    set cmd "set tdesc filename $filename"
+    set msg "set tdesc filename ($which architecture)"
     set cmd_regex [string_to_regexp $cmd]
     gdb_test_multiple $cmd $msg {
 	-re "^$cmd_regex\r\n$gdb_prompt $" {
@@ -86,31 +89,32 @@ proc set_arch { arch which } {
 	"The target architecture is set automatically \\(currently $arch\\)" \
 	"$cmd ($which architecture)"
 
-    file delete "${subdir}/tdesc-arch.xml"
-    remote_file host delete "tdesc-arch.xml"
+    remote_file host delete $filename
 }
 
 set_arch $arch1 first
 set_arch $arch2 second
 
 # Check an invalid architecture setting.
-set fd [open "${subdir}/tdesc-arch.xml" w]
+set filename [standard_output_file tdesc-arch.xml]
+set fd [open $filename w]
 puts $fd \
     "<target>
        <architecture>invalid</architecture>
      </target>"
 close $fd
-remote_download host "$subdir/tdesc-arch.xml" "tdesc-arch.xml"
+if {[is_remote host]} {
+    set filename [remote_download host $filename "tdesc-arch.xml"]
+}
 
-set cmd "set tdesc filename tdesc-arch.xml"
+set cmd "set tdesc filename $filename"
 gdb_test $cmd \
     "warning:.*Target description specified unknown architecture.*" \
-    "$cmd (invalid architecture)"
+    "set tdesc filename tdesc-arch.xml (invalid architecture)"
 
 set cmd "show architecture"
 gdb_test $cmd \
     "The target architecture is set automatically \\(currently $default_arch\\)" \
     "$cmd (invalid architecture)"
 
-file delete "${subdir}/tdesc-arch.xml"
-remote_file host delete "tdesc-arch.xml"
+remote_file host delete $filename
diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp
index 533812f..b9d631a 100644
--- a/gdb/testsuite/gdb.xml/tdesc-regs.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp
@@ -94,20 +94,24 @@ gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
 # Copy the core registers into the objdir if necessary, so that they
 # will be found by <xi:include>.
 foreach src ${core-regs} {
-    set file [remote_download host "$srcdir/../features/$regdir$src" "$src"]
+    set remote_filename($src) \
+	[gdb_remote_download host "$srcdir/../features/$regdir$src"]
 }
 
 # Similarly, we need to copy files under test into the objdir.
-proc load_description { file errmsg } {
+proc load_description { file errmsg {should_cd 1} } {
     global srcdir
     global subdir
     global gdb_prompt
     global core-regs
     global architecture
+    global remote_filename
 
-    file delete "$subdir/regs.xml"
+    set regs_file [standard_output_file regs.xml]
+
+    file delete $regs_file
     set ifd [open "$srcdir/$subdir/$file" r]
-    set ofd [open "$subdir/regs.xml" w]
+    set ofd [open $regs_file w]
     while {[gets $ifd line] >= 0} {
 	if {[regexp {<xi:include href="core-regs.xml"/>} $line]} {
 	    if {! [string equal ${architecture} ""]} {
@@ -122,11 +126,18 @@ proc load_description { file errmsg } {
     }
     close $ifd
     close $ofd
-    remote_download host "$subdir/regs.xml" "regs.xml"
-    file delete "$subdir/regs.xml"
+
+    if {[is_remote host]} {
+	set regs_file [remote_download host "$subdir/regs.xml" "regs.xml"]
+    }
+
+    if {$should_cd && ![is_remote host]} {
+	gdb_test "cd [file dirname $regs_file]" "Working directory .*" \
+	    "cd to directory holding xml"
+    }
 
     # Anchor the test output, so that error messages are detected.
-    set cmd "set tdesc filename regs.xml"
+    set cmd "set tdesc filename [file tail $regs_file]"
     set msg "set tdesc filename regs.xml - from $file"
     set cmd_regex [string_to_regexp $cmd]
     gdb_test_multiple $cmd $msg {
@@ -134,7 +145,10 @@ proc load_description { file errmsg } {
 	    pass $msg
 	}
     }
-    remote_file host delete "regs.xml"
+
+    if {[is_remote host]} {
+	remote_file host delete "regs.xml"
+    }
 }
 
 load_description "extra-regs.xml" ""
@@ -150,10 +164,10 @@ gdb_test "ptype \$structreg.v4" "type = int8_t __attribute__ \\(\\(vector_size\\
 gdb_test "ptype \$bitfields" \
     "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
 
-load_description "core-only.xml" ""
+load_description "core-only.xml" "" 0
 # The extra register from the previous description should be gone.
 gdb_test "ptype \$extrareg" "type = void"
 
 foreach src ${core-regs} {
-    remote_file host delete "$src"
+    remote_file host delete $remote_filename($src)
 }
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 09/13] update checkpoint test
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (5 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 05/13] fix up gdb.xml Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-23 20:37 ` [PATCH 11/13] introduce relative_filename and use it Tom Tromey
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes the "checkpoint" test to use the standard output directory.
This makes the test be parallel-safe.

	* gdb.base/checkpoint.c (main): Use PI_TXT and COPY1_TXT
	defines.
	* gdb.base/checkpoint.exp: Define PI_TXT and COPY1_TXT during
	compilation.  Use prepare_for_testing, standard_output_file.
---
 gdb/testsuite/gdb.base/checkpoint.c   |  6 +++---
 gdb/testsuite/gdb.base/checkpoint.exp | 30 ++++++++++++++++--------------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/gdb/testsuite/gdb.base/checkpoint.c b/gdb/testsuite/gdb.base/checkpoint.c
index c287094..d498047 100644
--- a/gdb/testsuite/gdb.base/checkpoint.c
+++ b/gdb/testsuite/gdb.base/checkpoint.c
@@ -28,8 +28,8 @@ main()
   long i;
   int c = 0;
 
-  in  = fopen ("pi.txt", "r");
-  out = fopen ("copy1.txt", "w");
+  in  = fopen (PI_TXT, "r");
+  out = fopen (COPY1_TXT, "w");
 
   if (!in || !out)
     {
@@ -54,6 +54,6 @@ main()
   fclose (in);
   fclose (out);
   printf ("Deleting copy.\n");	/* breakpoint 3 */
-  unlink ("copy1.txt");
+  unlink (COPY1_TXT);
   exit (0);			/* breakpoint 4 */
 }
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index b86fead..f1af471 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -27,23 +27,25 @@ if {![istarget "*-*-linux*"]} then {
 
 standard_testfile .c
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt]
+if {[is_remote host]} {
+    set copy1_txt copy1.txt
+} else {
+    set copy1_txt [standard_output_file copy1.txt]
+}
+
+if {[prepare_for_testing ${testfile}.exp $testfile $srcfile \
+	 [list debug "additional_flags=-DPI_TXT=\"$pi_txt\" -DCOPY1_TXT=\"$copy1_txt\""]]} {
      untested checkpoint.exp
      return -1
 }
 
-# Start with a fresh gdb
-
-clean_restart ${binfile}
-
 global gdb_prompt
 
 #
 # This tests gdb checkpoint and restart.
 #
 
-remote_download host ${srcdir}/${subdir}/pi.txt pi.txt
-
 runto_main
 set break1_loc [gdb_get_line_number "breakpoint 1"]
 set break2_loc [gdb_get_line_number "breakpoint 2"]
@@ -148,8 +150,8 @@ gdb_test "restart 0" "Switching to .*breakpoint 2.*" "restart 0 one"
 gdb_breakpoint $break3_loc
 gdb_test "continue" "breakpoint 3.*" "break3 one"
 
-gdb_test "shell diff -s pi.txt copy1.txt" \
-    "Files pi.txt and copy1.txt are identical.*" \
+gdb_test "shell diff -s $pi_txt $copy1_txt" \
+    "Files .*pi.txt and .*copy1.txt are identical.*" \
     "Diff input and output one"
 
 #
@@ -201,8 +203,8 @@ gdb_test "continue 1100" "breakpoint 1.*" "breakpoint 1 7 one"
 gdb_test "step" "if .c == EOF.*" "step in 7 two"
 gdb_test "print lines" " = 1162.*" "verify lines 7 two"
 
-gdb_test "shell diff -s pi.txt copy1.txt" \
-    "Files pi.txt and copy1.txt are identical.*" \
+gdb_test "shell diff -s $pi_txt $copy1_txt" \
+    "Files .*pi.txt and .*copy1.txt are identical.*" \
     "Diff input and output two"
 
 # 
@@ -214,8 +216,8 @@ gdb_test "restart 0" "Switching to .*breakpoint 3.*" "restart 0 one"
 gdb_breakpoint $break4_loc
 gdb_test "continue" "breakpoint 4.*" "break4 one"
 
-gdb_test "shell diff pi.txt copy1.txt" \
-    "diff: copy1.txt: No such file or directory" \
+gdb_test "shell diff $pi_txt $copy1_txt" \
+    "diff: .*copy1.txt: No such file or directory" \
     "delete copy1"
 
 delete_breakpoints
@@ -370,4 +372,4 @@ verbose "Timeout now $timeout sec."
 # Finished: cleanup
 #
 
-remote_exec build "rm -f pi.txt"
+remote_exec host "rm -f $pi_txt"
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 02/13] fix some simple thinkos in the test suite
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (8 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 03/13] fix weird.exp for parallel testing Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-23 20:37 ` [PATCH 01/13] fix up log-file toggling Tom Tromey
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes some parallelization thinkos from a while ago.  I'm not
sure how the problems ever slipped through.  In addition to a thinko
fix in twice.exp, this also finishes fixing it up for parallelization.

	* gdb.base/gcore-buffer-overflow.exp: Use
	standard_output_file, not standard_testfile.
	* gdb.base/twice.exp: Use standard_testfile, not
	standard_output_file.  Use gdb_remote_download.
---
 gdb/testsuite/gdb.base/gcore-buffer-overflow.exp | 3 ++-
 gdb/testsuite/gdb.base/twice.exp                 | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp b/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
index 8d0867e..47dccf9 100644
--- a/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
+++ b/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
@@ -51,4 +51,5 @@ if { ! [ runto_main ] } then {
     return -1
 }
 
-gdb_gcore_cmd [standard_testfile gcore-buffer-overflow.test] "save a corefile"
+gdb_gcore_cmd [standard_output_file gcore-buffer-overflow.test] \
+    "save a corefile"
diff --git a/gdb/testsuite/gdb.base/twice.exp b/gdb/testsuite/gdb.base/twice.exp
index 936ddcb..9e7e334 100644
--- a/gdb/testsuite/gdb.base/twice.exp
+++ b/gdb/testsuite/gdb.base/twice.exp
@@ -14,7 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-standard_output_file twice.c
+standard_testfile twice.c
 set options debug
 lappend options "additional_flags=-I."
 
@@ -23,7 +23,7 @@ set fileid [open $local_srcfile w]
 puts $fileid "#include \"twice.c\""
 close $fileid
 
-remote_download host ${srcdir}/${subdir}/twice.c twice.c
+gdb_remote_download host ${srcdir}/${subdir}/twice.c
 
 if  { [gdb_compile $local_srcfile "${binfile}" executable $options] != "" } {
      untested twice.exp
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 08/13] simple changes in gdb.base
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (10 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 01/13] fix up log-file toggling Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-27 13:31   ` Pedro Alves
  2013-08-23 20:37 ` [PATCH 10/13] update fileio test Tom Tromey
  2013-08-27 14:01 ` [PATCH 00/13] test suite parallel safety Pedro Alves
  13 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This makes more changes in gdb.base to make it parallel-safe.  I think
the changes in this particular patch are relatively straightforward,
so I've grouped them all together.

	* gdb.base/advance.exp: Use standard_testfile and
	prepare_for_testing.
	* gdb.base/bigcore.exp: Use standard_output_file.  "cd" to
	appropriate directory when local.
	* gdb.base/dump.exp: Use standard_output_file.  Update all
	"dump" and "restore" filenames.
	* gdb.base/interact.exp: Use standard_output_file.
	* gdb.base/jit-so.exp: Don't download file when local.
	* gdb.base/jit.exp (compile_jit_test): Don't download file
	when local.
	* gdb.base/list.exp: Use gdb_remote_download.
	* gdb.base/maint.exp: Use standard_output_file.
	* gdb.base/prelink.exp: Use standard_output_file.
	* gdb.base/save-bp.exp: Use standard_output_file.
	* gdb.base/sepdebug.exp: Use standard_testfile,
	standard_output_file.
	(test_different_dir): Don't declare objdir.
	* gdb.base/solib-search.exp: Use standard_output_file.
	* gdb.base/step-line.exp: Use gdb_remote_download.
	* gdb.base/trace-commands.exp: Use standard_output_file.
---
 gdb/testsuite/gdb.base/advance.exp        |  14 +--
 gdb/testsuite/gdb.base/bigcore.exp        |  14 ++-
 gdb/testsuite/gdb.base/dump.exp           | 155 ++++++++++++++++++------------
 gdb/testsuite/gdb.base/interact.exp       |   9 +-
 gdb/testsuite/gdb.base/jit-so.exp         |   6 +-
 gdb/testsuite/gdb.base/jit.exp            |   6 +-
 gdb/testsuite/gdb.base/list.exp           |   2 +-
 gdb/testsuite/gdb.base/maint.exp          |   6 +-
 gdb/testsuite/gdb.base/prelink.exp        |  12 +--
 gdb/testsuite/gdb.base/save-bp.exp        |  11 ++-
 gdb/testsuite/gdb.base/sepdebug.exp       |  41 ++++----
 gdb/testsuite/gdb.base/solib-search.exp   |  35 ++++---
 gdb/testsuite/gdb.base/step-line.exp      |   2 +-
 gdb/testsuite/gdb.base/trace-commands.exp |   9 +-
 14 files changed, 183 insertions(+), 139 deletions(-)

diff --git a/gdb/testsuite/gdb.base/advance.exp b/gdb/testsuite/gdb.base/advance.exp
index a4bcfe6..bd59387 100644
--- a/gdb/testsuite/gdb.base/advance.exp
+++ b/gdb/testsuite/gdb.base/advance.exp
@@ -15,21 +15,13 @@
 
 # advance.exp -- Expect script to test 'advance' in gdb
 
-set testfile advance
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-remote_exec build "rm -f ${binfile}"
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-    untested advance.exp
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+    untested $testfile.exp
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto_main] then {
     fail "Can't run to main"
     return 0
diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp
index ac3c5fb..8464195 100644
--- a/gdb/testsuite/gdb.base/bigcore.exp
+++ b/gdb/testsuite/gdb.base/bigcore.exp
@@ -47,7 +47,7 @@ if { [istarget "*-*-*irix*"] } {
 }
 
 standard_testfile .c
-set corefile ${binfile}.corefile
+set corefile [standard_output_file ${binfile}.corefile]
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
      untested bigcore.exp
@@ -60,6 +60,12 @@ clean_restart ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 gdb_test_no_output "set width 0"
 
+# Get the core into the output directory.
+if {![is_remote host]} {
+    gdb_test "cd [file dirname $corefile]" "Working directory .*" \
+	"cd to test directory"
+}
+
 if { ![runto_main] } then {
     gdb_suppress_tests
 }
@@ -139,7 +145,7 @@ set timeout $oldtimeout
 # Find the corefile
 set file ""
 foreach pat [list core.${inferior_pid} ${testfile}.core core] {
-    set names [glob -nocomplain $pat]
+    set names [glob -nocomplain [standard_output_file $pat]]
     if {[llength $names] == 1} {
 	set file [lindex $names 0]
 	remote_exec build "mv $file $corefile"
@@ -188,7 +194,9 @@ if {! $core_ok} {
 # Now load up that core file
 
 set test "load corefile"
-gdb_test_multiple "core $corefile" "$test" {
+# We use [file tail] because gdb is still "cd"d to the
+# output directory.
+gdb_test_multiple "core [file tail $corefile]" "$test" {
     -re "A program is being debugged already.  Kill it. .y or n. " {
 	send_gdb "y\n"
 	exp_continue
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index eb9be90..6b12373 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -63,7 +63,26 @@ if {${data_address} > ${max_32bit_address}} then {
 
 # Clean up any stale output files from previous test runs
 
-remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
+set filenames {}
+set all_files {
+    intarr1.bin intarr1b.bin intarr1.ihex
+    intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex
+    intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex
+    intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex
+    intstr2.srec intstr2.tekhex intarr3.srec
+}
+
+foreach file $all_files {
+    if {[is_remote host]} {
+	set this_name $file
+    } else {
+	set this_name [standard_output_file $file]
+    }
+
+    lappend filenames [set ${file} $this_name]
+}
+
+remote_exec host "rm -f $filenames"
 
 # Test help (FIXME:)
 
@@ -96,34 +115,34 @@ proc make_dump_file { command msg } {
     }
 }
 
-make_dump_file "dump val intarr1.bin intarray" \
+make_dump_file "dump val [set intarr1.bin] intarray" \
 	"dump array as value, default"
 
-make_dump_file "dump val intstr1.bin intstruct" \
+make_dump_file "dump val [set intstr1.bin] intstruct" \
 	"dump struct as value, default"
 
-make_dump_file "dump bin val intarr1b.bin intarray" \
+make_dump_file "dump bin val [set intarr1b.bin] intarray" \
 	"dump array as value, binary"
 
-make_dump_file "dump bin val intstr1b.bin intstruct" \
+make_dump_file "dump bin val [set intstr1b.bin] intstruct" \
 	"dump struct as value, binary"
 
-make_dump_file "dump srec val intarr1.srec intarray" \
+make_dump_file "dump srec val [set intarr1.srec] intarray" \
 	"dump array as value, srec"
 
-make_dump_file "dump srec val intstr1.srec intstruct" \
+make_dump_file "dump srec val [set intstr1.srec] intstruct" \
 	"dump struct as value, srec"
 
-make_dump_file "dump ihex val intarr1.ihex intarray" \
+make_dump_file "dump ihex val [set intarr1.ihex] intarray" \
 	"dump array as value, intel hex"
 
-make_dump_file "dump ihex val intstr1.ihex intstruct" \
+make_dump_file "dump ihex val [set intstr1.ihex] intstruct" \
 	"dump struct as value, intel hex"
 
-make_dump_file "dump tekhex val intarr1.tekhex intarray" \
+make_dump_file "dump tekhex val [set intarr1.tekhex] intarray" \
 	"dump array as value, tekhex"
 
-make_dump_file "dump tekhex val intstr1.tekhex intstruct" \
+make_dump_file "dump tekhex val [set intstr1.tekhex] intstruct" \
 	"dump struct as value, tekhex"
 
 proc capture_value { expression args } {
@@ -191,39 +210,39 @@ set struct_val   [capture_value "intstruct"]
 set array_ptr_type [capture_pointer_with_type "&intarray"]
 set struct_ptr_type [capture_pointer_with_type "&intstruct"]
 
-make_dump_file "dump mem intarr2.bin $array_start $array_end" \
+make_dump_file "dump mem [set intarr2.bin] $array_start $array_end" \
 	"dump array as memory, default"
 
-make_dump_file "dump  mem intstr2.bin $struct_start $struct_end" \
+make_dump_file "dump  mem [set intstr2.bin] $struct_start $struct_end" \
 	"dump struct as memory, default"
 
-make_dump_file "dump bin mem intarr2b.bin $array_start $array_end" \
+make_dump_file "dump bin mem [set intarr2b.bin] $array_start $array_end" \
 	"dump array as memory, binary"
 
-make_dump_file "dump bin mem intstr2b.bin $struct_start $struct_end" \
+make_dump_file "dump bin mem [set intstr2b.bin] $struct_start $struct_end" \
 	"dump struct as memory, binary"
 
-make_dump_file "dump srec mem intarr2.srec $array_start $array_end" \
+make_dump_file "dump srec mem [set intarr2.srec] $array_start $array_end" \
 	"dump array as memory, srec"
 
-make_dump_file "dump srec mem intstr2.srec $struct_start $struct_end" \
+make_dump_file "dump srec mem [set intstr2.srec] $struct_start $struct_end" \
 	"dump struct as memory, srec"
 
-make_dump_file "dump ihex mem intarr2.ihex $array_start $array_end" \
+make_dump_file "dump ihex mem [set intarr2.ihex] $array_start $array_end" \
 	"dump array as memory, ihex"
 
-make_dump_file "dump ihex mem intstr2.ihex $struct_start $struct_end" \
+make_dump_file "dump ihex mem [set intstr2.ihex] $struct_start $struct_end" \
 	"dump struct as memory, ihex"
 
-make_dump_file "dump tekhex mem intarr2.tekhex $array_start $array_end" \
+make_dump_file "dump tekhex mem [set intarr2.tekhex] $array_start $array_end" \
 	"dump array as memory, tekhex"
 
-make_dump_file "dump tekhex mem intstr2.tekhex $struct_start $struct_end" \
+make_dump_file "dump tekhex mem [set intstr2.tekhex] $struct_start $struct_end" \
 	"dump struct as memory, tekhex"
 
 # test complex expressions
 make_dump_file \
-	"dump srec mem intarr3.srec &intarray \(char *\) &intarray + sizeof intarray" \
+    "dump srec mem [set intarr3.srec] &intarray \(char *\) &intarray + sizeof intarray" \
 	"dump array as mem, srec, expressions"
 
 proc test_restore_saved_value { restore_args msg oldval newval } {
@@ -244,70 +263,70 @@ if ![string compare $is64bitonly "no"] then {
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.srec" "array as value, srec" \
+  test_restore_saved_value "[set intarr1.srec]" "array as value, srec" \
 	$array_val "intarray"
 
-  test_restore_saved_value "intstr1.srec" "struct as value, srec" \
+  test_restore_saved_value "[set intstr1.srec]" "struct as value, srec" \
 	$struct_val "intstruct"
 
   gdb_test "print zero_all ()" "void" "zero all"
 
-  test_restore_saved_value "intarr2.srec" "array as memory, srec" \
+  test_restore_saved_value "[set intarr2.srec]" "array as memory, srec" \
 	$array_val "intarray"
 
-  test_restore_saved_value "intstr2.srec" "struct as memory, srec" \
+  test_restore_saved_value "[set intstr2.srec]" "struct as memory, srec" \
 	$struct_val "intstruct"
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.ihex" "array as value, ihex" \
+  test_restore_saved_value "[set intarr1.ihex]" "array as value, ihex" \
 	$array_val "intarray"
 
-  test_restore_saved_value "intstr1.ihex" "struct as value, ihex" \
+  test_restore_saved_value "[set intstr1.ihex]" "struct as value, ihex" \
 	$struct_val "intstruct"
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr2.ihex" "array as memory, ihex" \
+  test_restore_saved_value "[set intarr2.ihex]" "array as memory, ihex" \
 	$array_val "intarray"
 
-  test_restore_saved_value "intstr2.ihex" "struct as memory, ihex" \
+  test_restore_saved_value "[set intstr2.ihex]" "struct as memory, ihex" \
 	$struct_val "intstruct"
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.tekhex" "array as value, tekhex" \
+  test_restore_saved_value "[set intarr1.tekhex]" "array as value, tekhex" \
 	$array_val "intarray"
 
-  test_restore_saved_value "intstr1.tekhex" "struct as value, tekhex" \
+  test_restore_saved_value "[set intstr1.tekhex]" "struct as value, tekhex" \
 	$struct_val "intstruct"
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr2.tekhex" "array as memory, tekhex" \
+  test_restore_saved_value "[set intarr2.tekhex]" "array as memory, tekhex" \
 	$array_val "intarray"
 
-  test_restore_saved_value "intstr2.tekhex" "struct as memory, tekhex" \
+  test_restore_saved_value "[set intstr2.tekhex]" "struct as memory, tekhex" \
 	$struct_val "intstruct"
 }
 
 gdb_test "print zero_all ()" ".*"
 
-test_restore_saved_value "intarr1.bin binary $array_start" \
+test_restore_saved_value "[set intarr1.bin] binary $array_start" \
 	"array as value, binary" \
 	$array_val "intarray"
 
-test_restore_saved_value "intstr1.bin binary $struct_start" \
+test_restore_saved_value "[set intstr1.bin] binary $struct_start" \
 	"struct as value, binary" \
 	$struct_val "intstruct"
 
 gdb_test "print zero_all ()" ".*"
 
-test_restore_saved_value "intarr2.bin binary $array_start" \
+test_restore_saved_value "[set intarr2.bin] binary $array_start" \
 	"array as memory, binary" \
 	$array_val "intarray"
 
-test_restore_saved_value "intstr2.bin binary $struct_start" \
+test_restore_saved_value "[set intstr2.bin] binary $struct_start" \
 	"struct as memory, binary" \
 	$struct_val "intstruct"
 
@@ -324,42 +343,42 @@ gdb_test "print zero_all ()" ".*"
 
 
 if ![string compare $is64bitonly "no"] then {
-  test_restore_saved_value "intarr1.srec $array2_offset" \
+  test_restore_saved_value "[set intarr1.srec] $array2_offset" \
 	"array copy, srec" \
 	$array_val "intarray2"
 
-  test_restore_saved_value "intstr1.srec $struct2_offset" \
+  test_restore_saved_value "[set intstr1.srec] $struct2_offset" \
 	"struct copy, srec" \
 	$struct_val "intstruct2"
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.ihex $array2_offset" \
+  test_restore_saved_value "[set intarr1.ihex] $array2_offset" \
 	"array copy, ihex" \
 	$array_val "intarray2"
 
-  test_restore_saved_value "intstr1.ihex $struct2_offset" \
+  test_restore_saved_value "[set intstr1.ihex] $struct2_offset" \
 	"struct copy, ihex" \
 	$struct_val "intstruct2"
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.tekhex $array2_offset" \
+  test_restore_saved_value "[set intarr1.tekhex] $array2_offset" \
 	"array copy, tekhex" \
 	$array_val "intarray2"
 
-  test_restore_saved_value "intstr1.tekhex $struct2_offset" \
+  test_restore_saved_value "[set intstr1.tekhex] $struct2_offset" \
 	"struct copy, tekhex" \
 	$struct_val "intstruct2"
 }
 
 gdb_test "print zero_all ()" ".*"
 
-test_restore_saved_value "intarr1.bin binary $array2_start" \
+test_restore_saved_value "[set intarr1.bin] binary $array2_start" \
 	"array copy, binary" \
 	$array_val "intarray2"
 
-test_restore_saved_value "intstr1.bin binary $struct2_start" \
+test_restore_saved_value "[set intstr1.bin] binary $struct2_start" \
 	"struct copy, binary" \
 	$struct_val "intstruct2"
 
@@ -382,7 +401,7 @@ set element4_offset \
 if ![string compare $is64bitonly "no"] then {
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.srec 0 $element3_start $element4_start" \
+  test_restore_saved_value "[set intarr1.srec] 0 $element3_start $element4_start" \
 	"array partial, srec" 4 "intarray\[3\]"
 
   gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1"
@@ -390,7 +409,7 @@ if ![string compare $is64bitonly "no"] then {
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.ihex 0 $element3_start $element4_start" \
+  test_restore_saved_value "[set intarr1.ihex] 0 $element3_start $element4_start" \
 	"array partial, ihex" 4 "intarray\[3\]"
 
   gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2"
@@ -398,7 +417,7 @@ if ![string compare $is64bitonly "no"] then {
 
   gdb_test "print zero_all ()" ".*"
 
-  test_restore_saved_value "intarr1.tekhex 0 $element3_start $element4_start" \
+  test_restore_saved_value "[set intarr1.tekhex] 0 $element3_start $element4_start" \
 	"array partial, tekhex" 4 "intarray\[3\]"
 
   gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 3"
@@ -408,7 +427,7 @@ if ![string compare $is64bitonly "no"] then {
 gdb_test "print zero_all ()" ".*"
 
 test_restore_saved_value \
-    "intarr1.bin binary $array_start $element3_offset $element4_offset" \
+    "[set intarr1.bin] binary $array_start $element3_offset $element4_offset" \
     "array partial, binary" 4 "intarray\[3\]"
 
 gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 4"
@@ -419,7 +438,7 @@ if ![string compare $is64bitonly "no"] then {
 
   # restore with expressions 
   test_restore_saved_value \
-	"intarr3.srec (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \
+	"[set intarr3.srec] (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \
 	"array partial with expressions" 4 "intarray2\[3\]"
 
   gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
@@ -471,41 +490,49 @@ proc test_reload_saved_value { filename msg oldval newval } {
 
 # srec format can not be loaded for 64-bit-only platforms
 if ![string compare $is64bitonly "no"] then {
-  test_reload_saved_value "intarr1.srec" "reload array as value, srec" \
+  test_reload_saved_value "[set intarr1.srec]" "reload array as value, srec" \
 	$array_val "\*$array_ptr_type"
-  test_reload_saved_value "intstr1.srec" "reload struct as value, srec" \
+  test_reload_saved_value "[set intstr1.srec]" "reload struct as value, srec" \
 	$struct_val "\*$struct_ptr_type"
-  test_reload_saved_value "intarr2.srec" "reload array as memory, srec" \
+  test_reload_saved_value "[set intarr2.srec]" "reload array as memory, srec" \
 	$array_val "\*$array_ptr_type"
-  test_reload_saved_value "intstr2.srec" "reload struct as memory, srec" \
+  test_reload_saved_value "[set intstr2.srec]" "reload struct as memory, srec" \
 	$struct_val "\*$struct_ptr_type"
 }
 
 # ihex format can not be loaded for 64-bit-only platforms
 if ![string compare $is64bitonly "no"] then {
 
-  test_reload_saved_value "intarr1.ihex" "reload array as value, intel hex" \
+  test_reload_saved_value "[set intarr1.ihex]" \
+      "reload array as value, intel hex" \
 	$array_val "\*$array_ptr_type"
-  test_reload_saved_value "intstr1.ihex" "reload struct as value, intel hex" \
+  test_reload_saved_value "[set intstr1.ihex]" \
+      "reload struct as value, intel hex" \
 	$struct_val "\*$struct_ptr_type"
-  test_reload_saved_value "intarr2.ihex" "reload array as memory, intel hex" \
+  test_reload_saved_value "[set intarr2.ihex]" \
+      "reload array as memory, intel hex" \
 	$array_val "\*$array_ptr_type"
-  test_reload_saved_value "intstr2.ihex" "reload struct as memory, intel hex" \
+  test_reload_saved_value "[set intstr2.ihex]" \
+      "reload struct as memory, intel hex" \
 	$struct_val "\*$struct_ptr_type"
 }
 
 # tekhex format can not be loaded for 64-bit-only platforms
 if ![string compare $is64bitonly "no"] then {
-  test_reload_saved_value "intarr1.tekhex" "reload array as value, tekhex" \
+  test_reload_saved_value "[set intarr1.tekhex]" \
+      "reload array as value, tekhex" \
 	$array_val "\*$array_ptr_type"
-  test_reload_saved_value "intstr1.tekhex" "reload struct as value, tekhex" \
+  test_reload_saved_value "[set intstr1.tekhex]" \
+      "reload struct as value, tekhex" \
 	$struct_val "\*$struct_ptr_type"
-  test_reload_saved_value "intarr2.tekhex" "reload array as memory, tekhex" \
+  test_reload_saved_value "[set intarr2.tekhex]" \
+      "reload array as memory, tekhex" \
 	$array_val "\*$array_ptr_type"
-  test_reload_saved_value "intstr2.tekhex" "reload struct as memory, tekhex" \
+  test_reload_saved_value "[set intstr2.tekhex]" \
+      "reload struct as memory, tekhex" \
 	$struct_val "\*$struct_ptr_type"
 }
 
 # clean up files
 
-remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
+remote_exec build "rm -f $filenames"
diff --git a/gdb/testsuite/gdb.base/interact.exp b/gdb/testsuite/gdb.base/interact.exp
index eb0d999..f0f0354 100644
--- a/gdb/testsuite/gdb.base/interact.exp
+++ b/gdb/testsuite/gdb.base/interact.exp
@@ -15,7 +15,8 @@
 
 # Create a GDB script that we can source.  The script needs to generate
 # some output, to allow us to verify that it is executed properly.
-set fd [open "zzz-gdbscript" "w"]
+set script [standard_output_file zzz-gdbscript]
+set fd [open $script "w"]
 puts $fd "print 1"
 puts $fd "print 2"
 close $fd
@@ -32,7 +33,7 @@ gdb_start
 # Verify that evaluating the script does not cause an unexpected
 # change of the interactive-mode setting.
 gdb_test_no_output "set interactive-mode auto"
-gdb_test "source zzz-gdbscript" "$script_output" \
+gdb_test "source $script" "$script_output" \
          "source script with interactive-mode auto"
 gdb_test "print 3" "= 3" "sanity check with interactive-mode auto"
 gdb_test "show interactive-mode" \
@@ -43,7 +44,7 @@ gdb_test "show interactive-mode" \
 # Verify that evaluating the script does not cause an unexpected
 # change of the interactive-mode setting.
 gdb_test_no_output "set interactive-mode on"
-gdb_test "source zzz-gdbscript" "$script_output" \
+gdb_test "source $script" "$script_output" \
          "source script with interactive-mode on"
 gdb_test "print 4" "= 4" "sanity check with interactive-mode on"
 gdb_test "show interactive-mode" \
@@ -54,7 +55,7 @@ gdb_test "show interactive-mode" \
 # Verify that evaluating the script does not cause an unexpected
 # change of the interactive-mode setting.
 gdb_test_no_output "set interactive-mode off"
-gdb_test "source zzz-gdbscript" "$script_output" \
+gdb_test "source $script" "$script_output" \
          "source script with interactive-mode off"
 gdb_test "print 5" "= 5" "sanity check with interactive-mode off"
 gdb_test "show interactive-mode" \
diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp
index 70f2a7d..67682cf 100644
--- a/gdb/testsuite/gdb.base/jit-so.exp
+++ b/gdb/testsuite/gdb.base/jit-so.exp
@@ -61,7 +61,11 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
     return -1
 }
 
-set solib_binfile_target [gdb_download ${solib_binfile}]
+if {[is_remote target]} {
+    set solib_binfile_target [gdb_download ${solib_binfile}]
+} else {
+    set solib_binfile_target $solib_binfile
+}
 
 proc one_jit_test {count match_str} {
     with_test_prefix "one_jit_test-$count" {
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index e5151c6..d04f176 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -56,7 +56,11 @@ proc compile_jit_test {testname options} {
 	return -1
     }
 
-    set solib_binfile_target [gdb_download ${solib_binfile}]
+    if {[is_remote target]} {
+	set solib_binfile_target [gdb_download ${solib_binfile}]
+    } else {
+	set solib_binfile_target $solib_binfile
+    }
 
     return 0
 }
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index 62504d1..c3cdc6b 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -19,7 +19,7 @@
 standard_testfile list0.c list1.c
 
 # Need to download the header to the host.
-remote_download host ${srcdir}/${subdir}/list0.h list0.h
+gdb_remote_download host ${srcdir}/${subdir}/list0.h
 
 if {[prepare_for_testing $testfile.exp $testfile [list $srcfile $srcfile2] \
 	 {debug}]} {
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 3093aae..9425f2b 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -278,11 +278,11 @@ gdb_expect  {
 
 # Check that maint print msymbols allows relative pathnames
 set mydir [pwd]
-gdb_test "cd ${objdir}" \
-    "Working directory [string_to_regexp ${objdir}]\..*" \
+gdb_test "cd [standard_output_file {}]" \
+    "Working directory .*\..*" \
     "cd to objdir"
 
-gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" {
+gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint print msymbols" {
     -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
     	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
 	    -re "msymbols_output2\r\n$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp
index ac70726..0043e3a 100644
--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -36,7 +36,7 @@ load_lib prelink-support.exp
 set testfile "prelink"
 
 set libsrcfile ${testfile}-lib.c
-set libfile ${objdir}/${subdir}/${testfile}.so
+set libfile [standard_output_file ${testfile}.so]
 
 # Use -soname so that the new library gets copied by build_executable_own_libs.
 
@@ -47,7 +47,7 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" [list d
 
 set srcfile ${testfile}.c
 set executable ${testfile}t
-set binfile ${objdir}/${subdir}/${executable}
+set binfile [standard_output_file ${executable}]
 set prelink_args [build_executable_own_libs ${testfile}.exp $executable $srcfile [list debug "ldflags=-Wl,${libfile},-rpath,[file dirname ${libfile}]"]]
 if {$prelink_args == ""} {
     return -1
@@ -66,13 +66,13 @@ if ![prelink_yes $prelink_args] {
 }
 
 set found 0
-set coredir "${objdir}/${subdir}/coredir.[getpid]"
+set coredir "[standard_output_file coredir.[getpid]]"
 file mkdir $coredir
 catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
 
 foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
     if [remote_file build exists $i] {
-	remote_exec build "mv $i ${objdir}/${subdir}/prelink.core"
+	remote_exec build "mv $i [standard_output_file prelink.core]"
 	set found 1
     }
 }
@@ -81,7 +81,7 @@ if { $found == 0 } {
     set names [glob -nocomplain -directory $coredir core.*]
     if {[llength $names] == 1} {
         set corefile [file join $coredir [lindex $names 0]]
-        remote_exec build "mv $corefile ${objdir}/${subdir}/prelink.core"
+        remote_exec build "mv $corefile [standard_output_file prelink.core]"
         set found 1
     }
 }
@@ -107,6 +107,6 @@ clean_restart $executable
 # Print the "adjusting expectations" message.
 gdb_test_no_output "set verbose on"
 
-gdb_test "core-file $objdir/$subdir/prelink.core" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message"
+gdb_test "core-file [standard_output_file prelink.core]" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message"
 
 gdb_test "p &bssvar == bssvarp" " = 1" ".dynbss vs. .bss address shift"
diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp
index 64df0f7..9afe127 100644
--- a/gdb/testsuite/gdb.base/save-bp.exp
+++ b/gdb/testsuite/gdb.base/save-bp.exp
@@ -48,8 +48,13 @@ gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands"
 gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*"
 
 # Now, save the breakpoints into a file...
-remote_file host delete "bps"
-gdb_test "save breakpoint bps"
+if {[is_remote host]} {
+    set bps bps
+} else {
+    set bps [standard_output_file bps]
+}
+remote_file host delete "$bps"
+gdb_test "save breakpoint $bps" "" "save breakpoint bps"
 
 # Now start a new debugger session...
 clean_restart $testfile
@@ -62,7 +67,7 @@ if ![runto_main] {
 delete_breakpoints
 
 # ... and restore the breakpoints.
-gdb_test "source bps"
+gdb_test "source $bps" "" "source bps"
 
 # Now, verify that all breakpoints have been created correctly...
 set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in"
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 9e956c7..632a43e 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -29,9 +29,7 @@
 # test running programs
 #
 
-set testfile "sepdebug"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}${EXEEXT}
+standard_testfile .c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
     untested sepdebug.exp
@@ -54,14 +52,15 @@ if [gdb_gnu_strip_debug $binfile] {
 # PR gdb/9538.  Verify that symlinked executable still finds the separate
 # debuginfo.
 #
-set old_subdir ${subdir}
-set subdir ${subdir}/pr9538
+set old_subdir $subdir
+set subdir [file join ${old_subdir} pr9538]
 
 # Cleanup any stale state.
-remote_exec build "rm -rf ${subdir}"
+set new_name [standard_output_file ${testfile}${EXEEXT}]
+remote_exec build "rm -rf [file dirname $new_name]"
 
-remote_exec build "mkdir ${subdir}"
-remote_exec build "ln -s ${binfile} ${subdir}"
+remote_exec build "mkdir [file dirname $new_name]"
+remote_exec build "ln -s ${binfile} $new_name"
 clean_restart ${testfile}${EXEEXT}
 if { $gdb_file_cmd_debug_info != "debug" } then {
     fail "No debug information found."
@@ -650,7 +649,7 @@ test_next_with_recursion
 
 proc test_different_dir {type test_different_dir xfail} {
     with_test_prefix "$type" {
-	global srcdir subdir objdir binfile srcfile timeout gdb_prompt
+	global srcdir subdir binfile srcfile timeout gdb_prompt
 	global bp_location6 decimal hex
 
 	gdb_exit
@@ -750,11 +749,11 @@ proc test_different_dir {type test_different_dir xfail} {
 # now move the .debug file to a different location so that we can test
 # the "set debug-file-directory" command.
 
-set different_dir "${objdir}/${subdir}/${testfile}.dir"
-set debugfile "${different_dir}/${objdir}/${subdir}/${testfile}.debug"
+set different_dir [standard_output_file ${testfile}.dir]
+set debugfile "${different_dir}/[standard_output_file ${testfile}.debug]"
 remote_exec build "rm -rf $different_dir"
 remote_exec build "mkdir -p [file dirname $debugfile]"
-remote_exec build "mv -f ${objdir}/${subdir}/${testfile}.debug $debugfile"
+remote_exec build "mv -f [standard_output_file ${testfile}.debug] $debugfile"
 
 test_different_dir debuglink $different_dir 0
 
@@ -762,17 +761,17 @@ test_different_dir debuglink $different_dir 0
 # Test CRC mismatch is reported.
 
 if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
-    && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} {
+    && ![gdb_gnu_strip_debug [standard_output_file sepdebug2]]} {
 
-    remote_exec build "cp ${debugfile} ${objdir}/${subdir}/sepdebug2.debug"
+    remote_exec build "cp ${debugfile} [standard_output_file sepdebug2.debug]"
 
     gdb_exit
     gdb_start
     gdb_reinitialize_dir $srcdir/$subdir
 
-    set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}]
+    set escapedobjdirsubdir [string_to_regexp [standard_output_file {}]]
 
-    gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported"
+    gdb_test "file [standard_output_file sepdebug2]" "warning: the debug information found in \"${escapedobjdirsubdir}/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported"
 }
 
 
@@ -797,17 +796,17 @@ if ![string compare $build_id_debug_filename ""] then {
 	pass $test
     }
 
-    file mkdir [file dirname ${objdir}/${subdir}/${build_id_debug_filename}]
-    remote_exec build "mv $debugfile ${objdir}/${subdir}/${build_id_debug_filename}"
+    file mkdir [file dirname [standard_output_file ${build_id_debug_filename}]]
+    remote_exec build "mv $debugfile [standard_output_file ${build_id_debug_filename}]"
 
-    test_different_dir build-id "${objdir}/${subdir}" $xfail
+    test_different_dir build-id [standard_output_file {}] $xfail
 
     # Test also multiple directories can be specified.  Without the build-id
     # reference GDB would find the separate debug info just at the same
     # location as the executable file.
 
-    test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail
+    test_different_dir multiple-dirs "/doesnotexist:[standard_output_file {}]" $xfail
 
     # Spare debug files may confuse testsuite runs in the future.
-    remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
+    remote_exec build "rm -f [standard_output_file ${build_id_debug_filename}]"
 }
diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp
index 9b10664..c3298d8 100644
--- a/gdb/testsuite/gdb.base/solib-search.exp
+++ b/gdb/testsuite/gdb.base/solib-search.exp
@@ -35,33 +35,35 @@ set right_lib_subdir "solib-search-right"
 # First library file.
 set libname1 "solib-search-lib1"
 set srcfile1_lib ${srcdir}/${subdir}/${libname1}.c
-set wrong_binfile1_lib ${objdir}/${subdir}/${wrong_lib_subdir}/${libname1}.so
-set right_binfile1_lib ${objdir}/${subdir}/${right_lib_subdir}/${libname1}.so
+set wrong_binfile1_lib \
+    [standard_output_file ${wrong_lib_subdir}/${libname1}.so]
+set right_binfile1_lib \
+    [standard_output_file ${right_lib_subdir}/${libname1}.so]
 # Second library file.
 set libname2 "solib-search-lib2"
 set srcfile2_lib ${srcdir}/${subdir}/${libname2}.c
-set wrong_binfile2_lib ${objdir}/${subdir}/${wrong_lib_subdir}/${libname2}.so
-set right_binfile2_lib ${objdir}/${subdir}/${right_lib_subdir}/${libname2}.so
+set wrong_binfile2_lib \
+    [standard_output_file ${wrong_lib_subdir}/${libname2}.so]
+set right_binfile2_lib \
+    [standard_output_file ${right_lib_subdir}/${libname2}.so]
 # Link with the library that lives here.
 # This is so that we can replace what gdb sees with the wrong copy,
 # and then tell gdb to use the right copy that lives someplace else.
-set binfile1_lib ${objdir}/${subdir}/${libname1}.so
-set binfile2_lib ${objdir}/${subdir}/${libname2}.so
+set binfile1_lib [standard_output_file ${libname1}.so]
+set binfile2_lib [standard_output_file ${libname2}.so]
 
 set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
 set wrong_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=1"
 set right_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=8192 -DRIGHT"
 
 # Binary file.
-set testfile "solib-search"
-set srcfile ${srcdir}/${subdir}/${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
 set bin_flags [list debug shlib=${binfile1_lib} shlib=${binfile2_lib}]
 
-remote_exec build "rm -rf ${subdir}/${wrong_lib_subdir}"
-remote_exec build "rm -rf ${subdir}/${right_lib_subdir}"
-remote_exec build "mkdir ${subdir}/${wrong_lib_subdir}"
-remote_exec build "mkdir ${subdir}/${right_lib_subdir}"
+remote_exec build "rm -rf [standard_output_file ${wrong_lib_subdir}]"
+remote_exec build "rm -rf [standard_output_file ${right_lib_subdir}]"
+remote_exec build "mkdir [standard_output_file ${wrong_lib_subdir}]"
+remote_exec build "mkdir [standard_output_file ${right_lib_subdir}]"
 
 if { [gdb_compile_shlib ${srcfile1_lib} ${wrong_binfile1_lib} $wrong_lib_flags] != ""
      || [gdb_compile_shlib ${srcfile2_lib} ${wrong_binfile2_lib} $wrong_lib_flags] != ""
@@ -74,7 +76,8 @@ if { [gdb_compile_shlib ${srcfile1_lib} ${wrong_binfile1_lib} $wrong_lib_flags]
 # Build the test binary using the right copies of the libraries.
 remote_exec build "ln -sf ${right_lib_subdir}/${libname1}.so ${binfile1_lib}"
 remote_exec build "ln -sf ${right_lib_subdir}/${libname2}.so ${binfile2_lib}"
-if { [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
+if { [gdb_compile $srcdir/$subdir/${srcfile} ${binfile} \
+	  executable $bin_flags] != "" } {
     untested "Could not compile $binfile."
     return -1
 }
@@ -89,7 +92,7 @@ if { ![runto_main] } {
 gdb_breakpoint "break_here"
 gdb_continue "break_here"
 
-set corefile "${objdir}/${subdir}/solib-search.core"
+set corefile [standard_output_file solib-search.core]
 set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
 
 if {!$core_supported} {
@@ -175,7 +178,7 @@ test_backtrace 1
 remote_exec build "rm -f ${binfile1_lib}"
 remote_exec build "rm -f ${binfile2_lib}"
 # Set solib-search-path to use the correct copies of libraries.
-gdb_test "set solib-search-path ${objdir}/${subdir}/${right_lib_subdir}" \
+gdb_test "set solib-search-path [standard_output_file ${right_lib_subdir}]" \
     "" \
     "set solib-search-path"
 
diff --git a/gdb/testsuite/gdb.base/step-line.exp b/gdb/testsuite/gdb.base/step-line.exp
index bc8f2bc..73113c7 100644
--- a/gdb/testsuite/gdb.base/step-line.exp
+++ b/gdb/testsuite/gdb.base/step-line.exp
@@ -33,7 +33,7 @@ if ![runto_main] then {
    return 0
 }
 
-set remote_linefile [remote_download host ${srcdir}/${subdir}/${linefile}]
+set remote_linefile [gdb_remote_download host ${srcdir}/${subdir}/${linefile}]
 
 gdb_test "break f1" ".*Breakpoint 2 at .* file .*step-line.c.*" "break f1"
 gdb_test "continue" \
diff --git a/gdb/testsuite/gdb.base/trace-commands.exp b/gdb/testsuite/gdb.base/trace-commands.exp
index ed49049..0ec77a0 100644
--- a/gdb/testsuite/gdb.base/trace-commands.exp
+++ b/gdb/testsuite/gdb.base/trace-commands.exp
@@ -20,7 +20,8 @@ gdb_exit
 gdb_start
 
 # Create a file to source
-set fd [open "tracecommandsscript" w]
+set tracecommandsscript [standard_output_file tracecommandsscript]
+set fd [open "$tracecommandsscript" w]
 puts $fd "\
 echo in tracecommandsscript\\n
 define func
@@ -44,7 +45,7 @@ gdb_test "show trace-commands" "State of GDB CLI command tracing is off\\." \
 	 "show trace-commands says off"
 
 # Source the script with verbose mode.
-gdb_test_sequence "source -v tracecommandsscript" "source -v" {
+gdb_test_sequence "source -v $tracecommandsscript" "source -v" {
   {[\r\n]\+echo in tracecommandsscript\\n}
   {[\r\n]\+define func}
   {[\r\n]\+if 1}
@@ -91,13 +92,13 @@ gdb_test_sequence "if 1\nset \$i = 0\nwhile \$i < 5\nfunc \$i\nset \$i += 1\nend
 }
 
 # Function with source works
-gdb_test_sequence "define topfunc\nsource tracecommandsscript\nend" \
+gdb_test_sequence "define topfunc\nsource $tracecommandsscript\nend" \
     "define user command" {
   {[\r\n]\+define topfunc}
 }
 gdb_test_sequence "topfunc" "nested trace-commands test with source" {
   {[\r\n]\+topfunc}
-  {[\r\n]\+\+source tracecommandsscript}
+  {[\r\n]\+\+source .*/tracecommandsscript}
   {[\r\n]\+\+echo in tracecommandsscript\\n}
   {[\r\n]\+\+define func}
   {[\r\n]\+\+if 1}
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 13/13] make gdb.asm parallel-safe
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (3 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 12/13] fix up gdb.server Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-27 13:48   ` Pedro Alves
  2013-08-23 20:37 ` [PATCH 05/13] fix up gdb.xml Tom Tromey
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes gdb.asm to be parallel-safe.

	* gdb.asm/asm-source.exp: Use standard_output_file.
---
 gdb/testsuite/gdb.asm/asm-source.exp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 5168452..511bd21 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -200,10 +200,13 @@ if [board_info $dest exists multilib_flags] {
 
 standard_testfile asmsrc1.s asmsrc2.s
 
-remote_exec build "rm -f ${subdir}/arch.inc"
-remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc
-remote_exec build "rm -f ${subdir}/note.inc"
-remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc
+set arch_inc [standard_output_file arch.inc]
+set note_inc [standard_output_file note.inc]
+
+remote_exec build "rm -f $arch_inc"
+remote_download host ${srcdir}/${subdir}/${asm-arch}.inc $arch_inc
+remote_exec build "rm -f $note_inc"
+remote_download host ${srcdir}/${subdir}/${asm-note}.inc $note_inc
 
 if { [string equal ${asm-flags} ""] } {
     set asm-flags "-I${srcdir}/${subdir} $obj_include"
@@ -467,5 +470,5 @@ test_dis "disassem &staticvar, &staticvar+1" "staticvar"
 gdb_test "disassem foostatic" ".*<\\+0>:.*End of assembler dump." \
 	"look at static function"
 
-remote_exec build "rm -f ${subdir}/arch.inc"
-remote_exec build "rm -f ${subdir}/note.inc"
+remote_exec build "rm -f $arch_inc"
+remote_exec build "rm -f $note_inc"
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 07/13] fix up gdb.trace
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
  2013-08-23 20:36 ` [PATCH 06/13] fix up gdb.mi Tom Tromey
  2013-08-23 20:36 ` [PATCH 04/13] fix up gdb.gdb Tom Tromey
@ 2013-08-23 20:37 ` Tom Tromey
  2013-08-27 12:26   ` Pedro Alves
  2013-08-23 20:37 ` [PATCH 12/13] fix up gdb.server Tom Tromey
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-08-23 20:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This fixes gdb.trace to be parallel-safe.

	* gdb.trace/mi-traceframe-changed.exp: Pass -DTFILE_DIR
	to compilation.  Use standard_output_file.
	(test_tfind_tfile): Update.
	* gdb.trace/tfile.c (write_basic_trace_file)
	(write_error_trace_file): Use TFILE_DIR.
	* gdb.trace/tfile.exp: Pass -DTFILE_DIR to compilation.  Use
	standard_output_file.
---
 gdb/testsuite/gdb.trace/mi-traceframe-changed.exp | 35 +++++++++++++----
 gdb/testsuite/gdb.trace/tfile.c                   |  4 +-
 gdb/testsuite/gdb.trace/tfile.exp                 | 47 ++++++++++++++++-------
 3 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
index 21e11d5..20ef2d8 100644
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
@@ -20,32 +20,51 @@ set MIFLAGS "-i=mi"
 standard_testfile tfile.c
 set executable $testfile
 
+set purely_local 0
+set tfile_basic tfile-basic.tf
+if {![is_remote host] && ![is_remote target]} {
+    set tfile_basic [standard_output_file $tfile_basic]
+    set tfile_dir [file dirname $tfile_basic]/
+    set purely_local 1
+} else {
+    set tfile_dir ""
+}
+
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-	   executable {debug nowarnings}] != "" } {
+	   executable \
+	   [list debug nowarnings \
+		"additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
+	  != "" } {
      untested ${testfile}.exp
      return -1
 }
 
-# Make sure we are starting fresh.
-remote_file host delete tfile-basic.tf
-remote_file target delete tfile-basic.tf
+if {!$purely_local} {
+    # Make sure we are starting fresh.
+    remote_file host delete tfile-basic.tf
+    remote_file target delete tfile-basic.tf
+}
 
 remote_exec target "$binfile"
-# Copy tracefile from target to host.
-remote_download host [remote_upload target tfile-basic.tf] \
-    tfile-basic.tf
+
+if {!$purely_local} {
+    # Copy tracefile from target to host.
+    remote_download host [remote_upload target tfile-basic.tf] \
+	tfile-basic.tf
+}
 
 proc test_tfind_tfile { } {
     with_test_prefix "tfile" {
 	global binfile
 	global decimal
+	global tfile_basic
 
 	if [mi_gdb_start] {
 	    return
 	}
 	mi_gdb_load ${binfile}
 
-	mi_gdb_test "-target-select tfile tfile-basic.tf" \
+	mi_gdb_test "-target-select tfile ${tfile_basic}" \
 	    ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
 	    "select trace file"
 
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index 7020744..3610086 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -92,7 +92,7 @@ write_basic_trace_file (void)
   int fd, int_x;
   short short_x;
 
-  fd = start_trace_file ("tfile-basic.tf");
+  fd = start_trace_file (TFILE_DIR "tfile-basic.tf");
 
   /* The next part of the file consists of newline-separated lines
      defining status, tracepoints, etc.  The section is terminated by
@@ -177,7 +177,7 @@ write_error_trace_file (void)
   int len = sizeof (made_up) - 1;
   char *hex = alloca (len * 2 + 1);
 
-  fd = start_trace_file ("tfile-error.tf");
+  fd = start_trace_file (TFILE_DIR "tfile-error.tf");
 
   /* The next part of the file consists of newline-separated lines
      defining status, tracepoints, etc.  The section is terminated by
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index b4a7460..02bf7ea 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -22,32 +22,49 @@
 
 load_lib "trace-support.exp"
 
+set tfile_basic tfile-basic.tf
+set tfile_error tfile-error.tf
+set purely_local 0
+if {![is_remote host] && ![is_remote target]} {
+    set tfile_basic [standard_output_file $tfile_basic]
+    set tfile_error [standard_output_file $tfile_error]
+    set tfile_dir [file dirname $tfile_basic]/
+    set purely_local 1
+} else {
+    set tfile_dir ""
+}
+
 gdb_exit
 gdb_start
 standard_testfile
 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-	  executable {debug nowarnings}] != "" } {
+	  executable \
+	  [list debug nowarnings \
+	       "additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
+	 != "" } {
     untested ${testfile}.exp
     return -1
 }
 gdb_reinitialize_dir $srcdir/$subdir
 
 # Make sure we are starting fresh.
-remote_file host delete tfile-basic.tf
-remote_file host delete tfile-error.tf
-remote_file target delete tfile-basic.tf
-remote_file target delete tfile-error.tf
+remote_file host delete $tfile_basic
+remote_file host delete $tfile_error
+remote_file target delete $tfile_basic
+remote_file target delete $tfile_error
 
 remote_exec target "$binfile"
-# Copy tracefile from target to host through build.
-remote_download host [remote_upload target tfile-basic.tf] tfile-basic.tf
-remote_download host [remote_upload target tfile-error.tf] tfile-error.tf
+if {!$purely_local} {
+    # Copy tracefile from target to host through build.
+    remote_download host [remote_upload target tfile-basic.tf] tfile-basic.tf
+    remote_download host [remote_upload target tfile-error.tf] tfile-error.tf
+}
 
 gdb_load $binfile
 
 # Program has presumably exited, now target a trace file it created.
 
-gdb_test "target tfile tfile-basic.tf" "Created tracepoint.*" \
+gdb_test "target tfile $tfile_basic" "Created tracepoint.*" \
     "target tfile"
 
 gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \
@@ -108,7 +125,7 @@ gdb_start
 
 gdb_load $binfile
 
-gdb_test "target tfile tfile-error.tf" "Created tracepoint.*" \
+gdb_test "target tfile $tfile_error" "Created tracepoint.*" \
     "target tfile"
 
 gdb_test "tstatus" \
@@ -124,14 +141,16 @@ gdb_test "info inferiors" "\\* 1    <null>\[ \t\]+${binfile}.*"
 
 # Make sure we can reopen without error.
 gdb_test \
-    "interpreter-exec mi \"-target-select tfile tfile-basic.tf\"" \
-    "\\^connected.*"
+    "interpreter-exec mi \"-target-select tfile $tfile_basic\"" \
+    "\\^connected.*" \
+    "interpreter-exec mi \"-target-select tfile tfile-basic.tf\""
 
 gdb_test "interpreter-exec mi \"-trace-status\"" \
-    "\\^done,supported=\"file\",trace-file=\".*tfile-basic.tf\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
+    "\\^done,supported=\"file\",trace-file=\".*$tfile_basic\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
     "-trace-status"
 
 # Test completion works well.
 
-gdb_test "target tfile tfile-basic\t" "Assuming tracepoint.*" \
+gdb_test "target tfile [file rootname $tfile_basic]\t" \
+    "Assuming tracepoint.*" \
     "complete-command 'target tfile'"
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 06/13] fix up gdb.mi
  2013-08-23 20:36 ` [PATCH 06/13] fix up gdb.mi Tom Tromey
@ 2013-08-25  1:50   ` Yao Qi
  2013-10-17 18:45     ` Tom Tromey
  0 siblings, 1 reply; 28+ messages in thread
From: Yao Qi @ 2013-08-25  1:50 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/24/2013 04:36 AM, Tom Tromey wrote:
>   	# No notification is emitted for 'maint set' commands.
>   	foreach boolean_opt { "on" "off" } {
> -	    mi_gdb_test "maint set profile ${boolean_opt}" \
> -		"\\&\"maint set profile ${boolean_opt}\\\\n\"\r\n\\^done" \
> -		"\"maint set profile ${boolean_opt}\""
> +	    mi_gdb_test "maint set dwarf2 always-disassemble ${boolean_opt}" \
> +		"\\&\"maint set dwarf2 always-disassemble ${boolean_opt}\\\\n\"\r\n\\^done" \
> +		"\"maint dwarf2 always-disassemble ${boolean_opt}\""
>   	}

Tom,
We replace "maint set profile" with "maint set dwarf2 
always-disassemble", because the former will cause gdb to generate a 
file on exit?

>
>   	# Full command parameters are included in the notification when a
> diff --git a/gdb/testsuite/gdb.mi/mi-file-transfer.exp b/gdb/testsuite/gdb.mi/mi-file-transfer.exp
> index 9229fde..edf1786 100644
> --- a/gdb/testsuite/gdb.mi/mi-file-transfer.exp
> +++ b/gdb/testsuite/gdb.mi/mi-file-transfer.exp
> @@ -54,15 +54,23 @@ proc mi_gdbserver_run { } {
>   }
>
>   proc test_file_transfer { filename description } {
> -    mi_gdb_test "-target-file-put \"$filename\" \"down-server\"" \
> +    if {![is_remote host] && ![is_remote target]} {
> +	set up_server [standard_output_file up-server]
> +	set down_server [standard_output_file down-server]
> +    } else {
> +	set up_server up-server
> +	set down_server down-server
> +    }
> +

IWBN to write comments, IMO.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 05/13] fix up gdb.xml
  2013-08-23 20:37 ` [PATCH 05/13] fix up gdb.xml Tom Tromey
@ 2013-08-27 12:12   ` Pedro Alves
  2013-10-17 18:42     ` Tom Tromey
  0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2013-08-27 12:12 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
> index 5fde2ff..be0b9f1 100644
> --- a/gdb/testsuite/gdb.xml/tdesc-arch.exp
> +++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp
> @@ -60,17 +60,20 @@ proc set_arch { arch which } {
>      global gdb_prompt
>      global subdir
>  
> -    set fd [open "$subdir/tdesc-arch.xml" w]
> +    set filename [standard_output_file tdesc-arch.xml]
> +    set fd [open $filename w]
>      puts $fd \
>  	"<target>
>  	    <architecture>$arch</architecture>
>  	 </target>"
>      close $fd
> -    remote_download host "${subdir}/tdesc-arch.xml" "tdesc-arch.xml"
> +    if {[is_remote host]} {
> +	set filename [remote_download host $filename tdesc-arch.xml]
> +    }
>  
>      # Anchor the test output, so that error messages are detected.
> -    set cmd "set tdesc filename tdesc-arch.xml"
> -    set msg "$cmd ($which architecture)"
> +    set cmd "set tdesc filename $filename"
> +    set msg "set tdesc filename ($which architecture)"

Should be:

    set msg "set tdesc filename tdesc-arch.xml ($which architecture)"

> -set cmd "set tdesc filename tdesc-arch.xml"
> +set cmd "set tdesc filename $filename"
>  gdb_test $cmd \
>      "warning:.*Target description specified unknown architecture.*" \
> -    "$cmd (invalid architecture)"
> +    "set tdesc filename tdesc-arch.xml (invalid architecture)"

(Like here.)

>      set cmd_regex [string_to_regexp $cmd]
>      gdb_test_multiple $cmd $msg {
>  	-re "^$cmd_regex\r\n$gdb_prompt $" {
> @@ -86,31 +89,32 @@ proc set_arch { arch which } {
>  	"The target architecture is set automatically \\(currently $arch\\)" \
>  	"$cmd ($which architecture)"
>  
> -    file delete "${subdir}/tdesc-arch.xml"
> -    remote_file host delete "tdesc-arch.xml"
> +    remote_file host delete $filename

I noticed this seems to leave the build machine's copy
behind.  Was that on purpose?

>  }


>  # Similarly, we need to copy files under test into the objdir.
> -proc load_description { file errmsg } {
> +proc load_description { file errmsg {should_cd 1} } {

Could you add a comment on the should_cd parameter please?
It's not obvious to me why a test should cd, while the other
shouldn't.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 07/13] fix up gdb.trace
  2013-08-23 20:37 ` [PATCH 07/13] fix up gdb.trace Tom Tromey
@ 2013-08-27 12:26   ` Pedro Alves
  2013-10-17 18:56     ` Tom Tromey
  0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2013-08-27 12:26 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
...
> +set purely_local 0
> +set tfile_basic tfile-basic.tf

Reads a bit odd to have these defaulted, but...

> +if {![is_remote host] && ![is_remote target]} {
> +    set tfile_basic [standard_output_file $tfile_basic]
> +    set tfile_dir [file dirname $tfile_basic]/
> +    set purely_local 1
> +} else {
> +    set tfile_dir ""

... not this one.  I'd move all defaults to this else
block.  Same in tfile.exp.

> +}

> -# Make sure we are starting fresh.
> -remote_file host delete tfile-basic.tf
> -remote_file target delete tfile-basic.tf
> +if {!$purely_local} {
> +    # Make sure we are starting fresh.
> +    remote_file host delete tfile-basic.tf
> +    remote_file target delete tfile-basic.tf
> +}

Shouldn't we delete the previous version of the file
in local mode?  tfile.exp does keep this unconditional.

In tfile.exp:

> -gdb_test "target tfile tfile-basic.tf" "Created tracepoint.*" \
> +gdb_test "target tfile $tfile_basic" "Created tracepoint.*" \
>      "target tfile"
>
>  gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \
> @@ -108,7 +125,7 @@ gdb_start
>
>  gdb_load $binfile
>
> -gdb_test "target tfile tfile-error.tf" "Created tracepoint.*" \
> +gdb_test "target tfile $tfile_error" "Created tracepoint.*" \
>      "target tfile"

This seems to introduce duplicated messages in gdb.sum.

(A good exercise would be to compare gdb.sum before/after whole series.)

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/13] simple changes in gdb.base
  2013-08-23 20:37 ` [PATCH 08/13] simple changes in gdb.base Tom Tromey
@ 2013-08-27 13:31   ` Pedro Alves
  2013-10-17 19:58     ` Tom Tromey
  0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2013-08-27 13:31 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> +
> +foreach file $all_files {
> +    if {[is_remote host]} {
> +	set this_name $file
> +    } else {
> +	set this_name [standard_output_file $file]
> +    }
> +
> +    lappend filenames [set ${file} $this_name]

Took me a second to realize/notice it's this loop that
creates the intarr1.bin etc. variables used in:

> +make_dump_file "dump val [set intarr1.bin] intarray"

etc.  How about adding a comment here, or above the loop?

> +}
> +
> +remote_exec host "rm -f $filenames"
>  
>  # Test help (FIXME:)
>  
> @@ -96,34 +115,34 @@ proc make_dump_file { command msg } {
>      }
>  }
>  
> -make_dump_file "dump val intarr1.bin intarray" \
> +make_dump_file "dump val [set intarr1.bin] intarray" \
>  	"dump array as value, default"


> --- a/gdb/testsuite/gdb.base/dump.exp
> +++ b/gdb/testsuite/gdb.base/dump.exp
> @@ -63,7 +63,26 @@ if {${data_address} > ${max_32bit_address}} then {
>
>  # Clean up any stale output files from previous test runs
>
> -remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
...
> +remote_exec host "rm -f $filenames"

...

>  # clean up files
>
> -remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
> +remote_exec build "rm -f $filenames"

s/build/host ?




>
> -set solib_binfile_target [gdb_download ${solib_binfile}]
> +if {[is_remote target]} {
> +    set solib_binfile_target [gdb_download ${solib_binfile}]
> +} else {
> +    set solib_binfile_target $solib_binfile
> +}
>

Sounds like this should be using gdb_load_shlibs.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 11/13] introduce relative_filename and use it
  2013-08-23 20:37 ` [PATCH 11/13] introduce relative_filename and use it Tom Tromey
@ 2013-08-27 13:44   ` Pedro Alves
  2013-10-17 18:59     ` Tom Tromey
  0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2013-08-27 13:44 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> +# ROOT and FULL are file names.  Returns the relative path from ROOT
> +# to FULL.  Note that FULL must be in a subdirectory of ROOT.

Would it be a good idea to "error" out on mistakes here?

> +    return [eval file join [lrange [file split $full] $len end]]


> +# For example, given ROOT = /usr/bin and FULL = /usr/bin/ls, this
> +# will return "ls".
> +
> +proc relative_filename {root full} {
> +    set len [llength [file split $root]]
> +    return [eval file join [lrange [file split $full] $len end]]
> +}

I think we'd just have to make sure full[1..len] equals root.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 13/13] make gdb.asm parallel-safe
  2013-08-23 20:37 ` [PATCH 13/13] make gdb.asm parallel-safe Tom Tromey
@ 2013-08-27 13:48   ` Pedro Alves
  2013-08-27 14:06     ` Tom Tromey
  0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2013-08-27 13:48 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> --- a/gdb/testsuite/gdb.asm/asm-source.exp
> +++ b/gdb/testsuite/gdb.asm/asm-source.exp
> @@ -200,10 +200,13 @@ if [board_info $dest exists multilib_flags] {
>  
>  standard_testfile asmsrc1.s asmsrc2.s
>  
> -remote_exec build "rm -f ${subdir}/arch.inc"
> -remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc
> -remote_exec build "rm -f ${subdir}/note.inc"
> -remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc
> +set arch_inc [standard_output_file arch.inc]
> +set note_inc [standard_output_file note.inc]
> +
> +remote_exec build "rm -f $arch_inc"
> +remote_download host ${srcdir}/${subdir}/${asm-arch}.inc $arch_inc

Preexisting, but I notice there seems to be an odd build/host mismatch here.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/13] test suite parallel safety
  2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
                   ` (12 preceding siblings ...)
  2013-08-23 20:37 ` [PATCH 10/13] update fileio test Tom Tromey
@ 2013-08-27 14:01 ` Pedro Alves
  13 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2013-08-27 14:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 08/23/2013 09:36 PM, Tom Tromey wrote:
> This is the final series to make the test suite parallel-safe.

Quite exciting!

I read the whole series, and patches I didn't reply
to were ones that simply looked good to me.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 13/13] make gdb.asm parallel-safe
  2013-08-27 13:48   ` Pedro Alves
@ 2013-08-27 14:06     ` Tom Tromey
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-08-27 14:06 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro> Preexisting, but I notice there seems to be an odd build/host
Pedro> mismatch here.

There are any number of these in the test suite.  I think nobody has
noticed since the cleanup code is generally irrelevant -- since it
doesn't fully work, nobody relies on it working.  In some cases, like
this one, the "rm" seems to be to work around possible permission
issues; but in practice nobody has ever hit those, either.

It would be great to do better here.  However, I doubt I'm going to do
so, since I don't have a need for it.  For the particular case of
parallel native testing, the problem is solved by isolating all the
outputs in a small set of directories.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 05/13] fix up gdb.xml
  2013-08-27 12:12   ` Pedro Alves
@ 2013-10-17 18:42     ` Tom Tromey
  2013-10-18 15:20       ` Pedro Alves
  0 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2013-10-17 18:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Should be:
Pedro>     set msg "set tdesc filename tdesc-arch.xml ($which architecture)"

Thanks, fixed here.

>> set cmd_regex [string_to_regexp $cmd]
>> gdb_test_multiple $cmd $msg {
>> -re "^$cmd_regex\r\n$gdb_prompt $" {
>> @@ -86,31 +89,32 @@ proc set_arch { arch which } {
>> "The target architecture is set automatically \\(currently $arch\\)" \
>> "$cmd ($which architecture)"
>> 
>> -    file delete "${subdir}/tdesc-arch.xml"
>> -    remote_file host delete "tdesc-arch.xml"
>> +    remote_file host delete $filename

Pedro> I noticed this seems to leave the build machine's copy
Pedro> behind.  Was that on purpose?

Yeah.  It seemed simpler to just leave it around.  I think it's
generally a mistake to delete intermediate files on the build machine --
it makes debugging the test suite harder, and with the parallel mode it
is generally trivial to clean up anyway.

>> # Similarly, we need to copy files under test into the objdir.
>> -proc load_description { file errmsg } {
>> +proc load_description { file errmsg {should_cd 1} } {

Pedro> Could you add a comment on the should_cd parameter please?
Pedro> It's not obvious to me why a test should cd, while the other
Pedro> shouldn't.

Done.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 06/13] fix up gdb.mi
  2013-08-25  1:50   ` Yao Qi
@ 2013-10-17 18:45     ` Tom Tromey
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-10-17 18:45 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

>> # No notification is emitted for 'maint set' commands.
>> foreach boolean_opt { "on" "off" } {
>> -	    mi_gdb_test "maint set profile ${boolean_opt}" \
>> -		"\\&\"maint set profile ${boolean_opt}\\\\n\"\r\n\\^done" \
>> -		"\"maint set profile ${boolean_opt}\""
>> +	    mi_gdb_test "maint set dwarf2 always-disassemble ${boolean_opt}" \
>> + "\\&\"maint set dwarf2 always-disassemble
>> ${boolean_opt}\\\\n\"\r\n\\^done" \
>> +		"\"maint dwarf2 always-disassemble ${boolean_opt}\""
>> }

Yao> We replace "maint set profile" with "maint set dwarf2
Yao> always-disassemble", because the former will cause gdb to generate a
Yao> file on exit?

Yes.  The choice of command is incidental to the test, and this change
avoids the appearance of parallel-unsafe-ness.

>> 
>> proc test_file_transfer { filename description } {
>> -    mi_gdb_test "-target-file-put \"$filename\" \"down-server\"" \
>> +    if {![is_remote host] && ![is_remote target]} {
>> +	set up_server [standard_output_file up-server]
>> +	set down_server [standard_output_file down-server]
>> +    } else {
>> +	set up_server up-server
>> +	set down_server down-server
>> +    }
>> +

Yao> IWBN to write comments, IMO.

Done now, thanks.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 07/13] fix up gdb.trace
  2013-08-27 12:26   ` Pedro Alves
@ 2013-10-17 18:56     ` Tom Tromey
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-10-17 18:56 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> ... not this one.  I'd move all defaults to this else
Pedro> block.  Same in tfile.exp.

Done.

>> -# Make sure we are starting fresh.
>> -remote_file host delete tfile-basic.tf
>> -remote_file target delete tfile-basic.tf
>> +if {!$purely_local} {
>> +    # Make sure we are starting fresh.
>> +    remote_file host delete tfile-basic.tf
>> +    remote_file target delete tfile-basic.tf
>> +}

Pedro> Shouldn't we delete the previous version of the file
Pedro> in local mode?  tfile.exp does keep this unconditional.

Done.

>> -gdb_test "target tfile tfile-basic.tf" "Created tracepoint.*" \
>> +gdb_test "target tfile $tfile_basic" "Created tracepoint.*" \
>> "target tfile"
>> 
>> gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \
>> @@ -108,7 +125,7 @@ gdb_start
>> 
>> gdb_load $binfile
>> 
>> -gdb_test "target tfile tfile-error.tf" "Created tracepoint.*" \
>> +gdb_test "target tfile $tfile_error" "Created tracepoint.*" \
>> "target tfile"

Pedro> This seems to introduce duplicated messages in gdb.sum.

Fixed.

Pedro> (A good exercise would be to compare gdb.sum before/after whole series.)

Yeah, I did do that, and I believe my comparison script handles
duplicates properly.  But I will redo it before resending the branch.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 11/13] introduce relative_filename and use it
  2013-08-27 13:44   ` Pedro Alves
@ 2013-10-17 18:59     ` Tom Tromey
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-10-17 18:59 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 08/23/2013 09:36 PM, Tom Tromey wrote:
>> +# ROOT and FULL are file names.  Returns the relative path from ROOT
>> +# to FULL.  Note that FULL must be in a subdirectory of ROOT.

Pedro> Would it be a good idea to "error" out on mistakes here?

Good idea, I added this.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/13] simple changes in gdb.base
  2013-08-27 13:31   ` Pedro Alves
@ 2013-10-17 19:58     ` Tom Tromey
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2013-10-17 19:58 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 08/23/2013 09:36 PM, Tom Tromey wrote:
>> +
>> +foreach file $all_files {
>> +    if {[is_remote host]} {
>> +	set this_name $file
>> +    } else {
>> +	set this_name [standard_output_file $file]
>> +    }
>> +
>> +    lappend filenames [set ${file} $this_name]

Pedro> Took me a second to realize/notice it's this loop that
Pedro> creates the intarr1.bin etc. variables used in:

>> +make_dump_file "dump val [set intarr1.bin] intarray"

Pedro> etc.  How about adding a comment here, or above the loop?

Done.

>> # clean up files
>> 
>> -remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex
>> intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex
>> intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex
>> intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex
>> intstr2.srec intstr2.tekhex intarr3.srec"
>> +remote_exec build "rm -f $filenames"

Pedro> s/build/host ?

Yeah, I think so.  I had left it as it was before, but I do think it's
wrong.  I fixed it here.

>> 
>> -set solib_binfile_target [gdb_download ${solib_binfile}]
>> +if {[is_remote target]} {
>> +    set solib_binfile_target [gdb_download ${solib_binfile}]
>> +} else {
>> +    set solib_binfile_target $solib_binfile
>> +}
>> 

Pedro> Sounds like this should be using gdb_load_shlibs.

gdb_load_shlibs sets solib-search-path and I think this particular test
is also testing for the case where it is set improperly.  So, I think
switching to gdb_load_shlibs would need even more work.

Tom

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 05/13] fix up gdb.xml
  2013-10-17 18:42     ` Tom Tromey
@ 2013-10-18 15:20       ` Pedro Alves
  0 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2013-10-18 15:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 10/17/2013 07:42 PM, Tom Tromey wrote:
> Yeah.  It seemed simpler to just leave it around.  I think it's
> generally a mistake to delete intermediate files on the build machine --
> it makes debugging the test suite harder, 

*nod*

> and with the parallel mode it
> is generally trivial to clean up anyway.

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2013-10-18 15:20 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23 20:36 [PATCH 00/13] test suite parallel safety Tom Tromey
2013-08-23 20:36 ` [PATCH 06/13] fix up gdb.mi Tom Tromey
2013-08-25  1:50   ` Yao Qi
2013-10-17 18:45     ` Tom Tromey
2013-08-23 20:36 ` [PATCH 04/13] fix up gdb.gdb Tom Tromey
2013-08-23 20:37 ` [PATCH 07/13] fix up gdb.trace Tom Tromey
2013-08-27 12:26   ` Pedro Alves
2013-10-17 18:56     ` Tom Tromey
2013-08-23 20:37 ` [PATCH 12/13] fix up gdb.server Tom Tromey
2013-08-23 20:37 ` [PATCH 13/13] make gdb.asm parallel-safe Tom Tromey
2013-08-27 13:48   ` Pedro Alves
2013-08-27 14:06     ` Tom Tromey
2013-08-23 20:37 ` [PATCH 05/13] fix up gdb.xml Tom Tromey
2013-08-27 12:12   ` Pedro Alves
2013-10-17 18:42     ` Tom Tromey
2013-10-18 15:20       ` Pedro Alves
2013-08-23 20:37 ` [PATCH 09/13] update checkpoint test Tom Tromey
2013-08-23 20:37 ` [PATCH 11/13] introduce relative_filename and use it Tom Tromey
2013-08-27 13:44   ` Pedro Alves
2013-10-17 18:59     ` Tom Tromey
2013-08-23 20:37 ` [PATCH 03/13] fix weird.exp for parallel testing Tom Tromey
2013-08-23 20:37 ` [PATCH 02/13] fix some simple thinkos in the test suite Tom Tromey
2013-08-23 20:37 ` [PATCH 01/13] fix up log-file toggling Tom Tromey
2013-08-23 20:37 ` [PATCH 08/13] simple changes in gdb.base Tom Tromey
2013-08-27 13:31   ` Pedro Alves
2013-10-17 19:58     ` Tom Tromey
2013-08-23 20:37 ` [PATCH 10/13] update fileio test Tom Tromey
2013-08-27 14:01 ` [PATCH 00/13] test suite parallel safety Pedro Alves

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).