[binutils-gdb] testsuite: Make standard_temp_file use invocation-specific directories
Simon Marchi
simark@sourceware.org
Tue Feb 16 14:02:00 GMT 2016
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c4ef31bf6fb68f0024800565a532015fc3390aaa
commit c4ef31bf6fb68f0024800565a532015fc3390aaa
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Tue Feb 16 09:00:51 2016 -0500
testsuite: Make standard_temp_file use invocation-specific directories
Just like standard_output_file, standard_temp_file should use multiple
directories to make the tests parallel-safe. However,
standard_temp_file is sometimes called in some procedures that are not
test-specific. For example, gdb_init uses it, but is called once before
all test files are ran. Therefore, we can't organize it in a
temp/gdb.subdir/testname layout, like standard_output_file.
Because it's just meant for temporary files that don't really need to be
inspected after the test, we can just put them in a directory based on
the runtest pid. There is always a single exp file being executed by a
particular runtest invocation at any given time, so it should be safe.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (standard_temp_file): Return a path specific to
the runtest invocation.
Diff:
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/lib/gdb.exp | 13 ++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5c663ef..fa4eecf 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2016-02-16 Simon Marchi <simon.marchi@ericsson.com>
+ * lib/gdb.exp (standard_temp_file): Return a path specific to
+ the runtest invocation.
+
+2016-02-16 Simon Marchi <simon.marchi@ericsson.com>
+
* gdb.trace/save-trace.exp: Change relative path to be in the
standard output directory.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1fb05c4..a77bce4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4339,13 +4339,12 @@ proc standard_output_file {basename} {
# Return the name of a file in our standard temporary directory.
proc standard_temp_file {basename} {
- global objdir GDB_PARALLEL
-
- if {[info exists GDB_PARALLEL]} {
- return [make_gdb_parallel_path temp $basename]
- } else {
- return $basename
- }
+ # Since a particular runtest invocation is only executing a single test
+ # file at any given time, we can use the runtest pid to build the
+ # path of the temp directory.
+ set dir [make_gdb_parallel_path temp [pid]]
+ file mkdir $dir
+ return [file join $dir $basename]
}
# Set 'testfile', 'srcfile', and 'binfile'.
More information about the Gdb-cvs
mailing list