[PATCH 4/4] gdb/testsuite: Pipe the dg-extract-results file list via stdin

Pedro Alves <[email protected]> Thu, 23 Jul 2026 18:51:31 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
The parallel-testing targets combine the per-test result files into a
single gdb.sum / gdb.log pair with the DG_EXTRACT_RESULTS macro, which
passes the whole list to contrib/dg-extract-results.sh on the command
line, one positional argument per file:

 $(SHELL) .../dg-extract-results.sh \
   `find $(1) -name gdb.sum -print` > $(2)/gdb.sum

A parallel run writes one gdb.sum (and one gdb.log) per .exp, so with
GDB's testsuite the whole list is thousands of paths.  On Windows with
native Windows Python that overflows the command-line length limit
(~32 KB), and the run dies while combining the results:

 $ make check-parallel
 ...
 .../dg-extract-results.sh: line 39: /ucrt64/bin/python3: Argument list too long
 make: *** [Makefile:274: check-parallel] Error 2
 ...
 $ find outputs/ -name gdb.sum | wc -l
 2657

An earlier commit taught dg-extract-results.sh/dg-extract-results.py a
-f option that reads the file list from a file, or from standard input
when the argument is "-", so we can now fix this by piping the find
output into dg-extract-results.sh via stdin instead, so the command
line length limit no longer applies.

Change-Id: I5d8c94332eda9bf49c9b0144dabb846de1102f57
---
 gdb/testsuite/Makefile.in | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index f671e90e125..11782a860db 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -257,11 +257,18 @@ check-single-racy:
 # Combine the individual gdb.sum / gdb.log files found anywhere under
 # directory $(1) into a single gdb.sum / gdb.log pair in directory
 # $(2), using contrib/dg-extract-results.sh.
+#
+# The file list is piped in via "-f -" rather than expanded onto the
+# command line: a parallel run writes one gdb.sum/gdb.log per .exp, so
+# the list can hold thousands of paths and overflow the command-line
+# length limit (notably on Windows, where the limit is ~32 KB).
 define DG_EXTRACT_RESULTS
-	$(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
-	  `find $(1) -name gdb.sum -print` > $(2)/gdb.sum; \
-	$(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
-	  `find $(1) -name gdb.log -print` > $(2)/gdb.log
+	find $(1) -name gdb.sum -print \
+	  | $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -f - \
+	  > $(2)/gdb.sum; \
+	find $(1) -name gdb.log -print \
+	  | $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L -f - \
+	  > $(2)/gdb.log
 endef
 
 check-parallel:
-- 
2.54.0