aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-05-04 10:41:09 +0200
committerTom de Vries <tdevries@suse.de>2024-05-04 10:41:09 +0200
commitc479e964a86984cbf3278845615c04ada8adfb50 (patch)
tree8ac289492520bc8611f406c913fbbbfac24dad3b /gdb
parente82dca2a57b05a95d45be74cb59046c79c9ed7d3 (diff)
downloadbinutils-c479e964a86984cbf3278845615c04ada8adfb50.zip
binutils-c479e964a86984cbf3278845615c04ada8adfb50.tar.gz
binutils-c479e964a86984cbf3278845615c04ada8adfb50.tar.bz2
[gdb/testsuite] Use unique portnum in parallel testing (check//% case)
Make target check//% is the gdb variant of a similar gcc make target [1]. When running tests using check//%: ... $ cd build/gdb $ make check//unix/{-fPIE/-pie,-fno-PIE/-no-pie} -j2 TESTS=gdb.server/*.exp ... we get: ... $ cat build/gdb/testsuite.unix.-fPIE.-pie/cache/portnum 2427 $ cat build/gdb/testsuite.unix.-fno-PIE.-no-pie/cache/portnum 2423 ... The problem is that there are two portnum files used in parallel. Fix this by: - creating a common lockdir build/gdb/testsuite.lockdir for make target check//%, - passing this down to the runtests invocations using variable GDB_LOCK_DIR, and - using GDB_LOCK_DIR in lock_dir. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR testsuite/31632 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31632 [1] https://gcc.gnu.org/install/test.html
Diffstat (limited to 'gdb')
-rw-r--r--gdb/Makefile.in8
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp5
2 files changed, 11 insertions, 2 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index cb19de6..234d005 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2003,6 +2003,10 @@ check-all-boards: force
$(MAKE) $(TARGET_FLAGS_TO_PASS) check-all-boards; \
else true; fi
+testsuite.lockdir: force
+ rm -rf $@
+ mkdir -p $@
+
# The idea is to parallelize testing of multilibs, for example:
# make -j3 check//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
# will run 3 concurrent sessions of check, eventually testing all 10
@@ -2011,7 +2015,7 @@ check-all-boards: force
# used, this rule will harmlessly fail to match. Used FORCE_PARALLEL to
# prevent serialized checking due to the passed RUNTESTFLAGS.
# FIXME: use config.status --config not --version, when available.
-check//%: force
+check//%: force testsuite.lockdir
@if [ -f testsuite/config.status ]; then \
rootme=`pwd`; export rootme; \
rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
@@ -2029,7 +2033,7 @@ check//%: force
); \
else :; fi && cd $$testdir && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) \
- RUNTESTFLAGS="--target_board=$$variant $(RUNTESTFLAGS)" \
+ RUNTESTFLAGS="GDB_LOCK_DIR=$$rootme/testsuite.lockdir --target_board=$$variant $(RUNTESTFLAGS)" \
FORCE_PARALLEL=$(if $(FORCE_PARALLEL),1,$(if $(RUNTESTFLAGS),,1)) \
"$$target"; \
else true; fi
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 1f30d80..95c53d0 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -180,6 +180,11 @@ proc lock_file_release {info} {
# Return directory where we keep lock files.
proc lock_dir {} {
+ if { [info exists ::GDB_LOCK_DIR] } {
+ # When using check//.
+ return $::GDB_LOCK_DIR
+ }
+
return [make_gdb_parallel_path cache]
}