aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-08-03 09:17:40 -0700
committerDoug Evans <dje@google.com>2015-08-03 09:17:40 -0700
commit3d3389010c00504602656ba6f16c6b91ade75243 (patch)
tree9213d2fc621d39227f3f6a0f87ac387fcb0a2508 /gdb/testsuite/lib
parentaf061d3e9c09baa0df2f2d4724baed06cc6158ca (diff)
downloadgdb-3d3389010c00504602656ba6f16c6b91ade75243.zip
gdb-3d3389010c00504602656ba6f16c6b91ade75243.tar.gz
gdb-3d3389010c00504602656ba6f16c6b91ade75243.tar.bz2
Add parallel build support for perf tests.
gdb/testsuite/ChangeLog: * Makefile.in (workers/%.worker, build-perf): New rule. (GDB_PERFTEST_MODE): New variable. (check-perf): Use it. (clean): Clean up gdb.perf parallel build subdirs. * lib/build-piece.exp: New file. * lib/gdb.exp (make_gdb_parallel_path): New function (standard_output_file, standard_temp_file): Call it. (GDB_PARALLEL handling): Make outputs,temp,cache directories as subdirs of $GDB_PARALLEL. * lib/cache.exp (gdb_do_cache): Call make_gdb_parallel_path.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/build-piece.exp39
-rw-r--r--gdb/testsuite/lib/cache.exp2
-rw-r--r--gdb/testsuite/lib/gdb.exp29
3 files changed, 66 insertions, 4 deletions
diff --git a/gdb/testsuite/lib/build-piece.exp b/gdb/testsuite/lib/build-piece.exp
new file mode 100644
index 0000000..a81530c
--- /dev/null
+++ b/gdb/testsuite/lib/build-piece.exp
@@ -0,0 +1,39 @@
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Utility to bootstrap building a piece of a performance test in a
+# parallel build.
+# See testsuite/Makefile.in:workers/%.worker.
+# WORKER is set by the makefile and is
+# "{program_name}/{program_name}-{worker_nr}".
+
+regexp "^\(.+\)/\(.+\)-\(\[0-9\]+\)$" $WORKER entire_match PROGRAM_NAME pname2 WORKER_NR
+
+if { ![info exists entire_match] || $entire_match != $WORKER } {
+ error "Bad value for WORKER: $WORKER"
+}
+if { $PROGRAM_NAME != $pname2 } {
+ error "Bad value for WORKER: $WORKER"
+}
+
+# $subdir is set to "lib", because that is where this file lives,
+# which is not what tests expect.
+set subdir "gdb.perf"
+
+# $gdb_test_file_name is set to this file, build-piece, which is not what
+# tests expect.
+set gdb_test_file_name $PROGRAM_NAME
+
+source $srcdir/$subdir/${gdb_test_file_name}.exp
diff --git a/gdb/testsuite/lib/cache.exp b/gdb/testsuite/lib/cache.exp
index 8df04b9..968e9ff 100644
--- a/gdb/testsuite/lib/cache.exp
+++ b/gdb/testsuite/lib/cache.exp
@@ -35,7 +35,7 @@ proc gdb_do_cache {name} {
}
if {[info exists GDB_PARALLEL]} {
- set cache_filename [file join $objdir cache $cache_name]
+ set cache_filename [make_gdb_parallel_path cache $cache_name]
if {[file exists $cache_filename]} {
set fd [open $cache_filename]
set gdb_data_cache($cache_name) [read -nonewline $fd]
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 986d920..5659906 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4073,6 +4073,26 @@ proc default_gdb_init { test_file_name } {
}
}
+# Return a path using GDB_PARALLEL.
+# ARGS is a list of path elements to append to "$objdir/$GDB_PARALLEL".
+# GDB_PARALLEL must be defined, the caller must check.
+#
+# The default value for GDB_PARALLEL is, canonically, ".".
+# The catch is that tests don't expect an additional "./" in file paths so
+# omit any directory for the default case.
+# GDB_PARALLEL is written as "yes" for the default case in Makefile.in to mark
+# its special handling.
+
+proc make_gdb_parallel_path { args } {
+ global GDB_PARALLEL objdir
+ set joiner [list "file" "join" $objdir]
+ if { $GDB_PARALLEL != "yes" } {
+ lappend joiner $GDB_PARALLEL
+ }
+ set joiner [concat $joiner $args]
+ return [eval $joiner]
+}
+
# Turn BASENAME into a full file name in the standard output
# directory. It is ok if BASENAME is the empty string; in this case
# the directory is returned.
@@ -4081,7 +4101,7 @@ proc standard_output_file {basename} {
global objdir subdir gdb_test_file_name GDB_PARALLEL
if {[info exists GDB_PARALLEL]} {
- set dir [file join $objdir outputs $subdir $gdb_test_file_name]
+ set dir [make_gdb_parallel_path outputs $subdir $gdb_test_file_name]
file mkdir $dir
return [file join $dir $basename]
} else {
@@ -4095,7 +4115,7 @@ proc standard_temp_file {basename} {
global objdir GDB_PARALLEL
if {[info exists GDB_PARALLEL]} {
- return [file join $objdir temp $basename]
+ return [make_gdb_parallel_path temp $basename]
} else {
return $basename
}
@@ -5220,7 +5240,10 @@ if {[info exists GDB_PARALLEL]} {
if {[is_remote host]} {
unset GDB_PARALLEL
} else {
- file mkdir outputs temp cache
+ file mkdir \
+ [make_gdb_parallel_path outputs] \
+ [make_gdb_parallel_path temp] \
+ [make_gdb_parallel_path cache]
}
}