gnu/gcc/688e32e919c8a645de680f91be6feb63215bb6f4 dg-extract-results.{sh,py}: Optionally read file list from stdin/file
dg-extract-results.sh and dg-extract-results.py take the summary/log
files to combine as command-line arguments, one argument per file.
That is fine for GCC, whose parallel harness produces a handful of
files.
GDB uses these scripts too, but its parallel harness writes one .sum
(and one .log) per test script, of which there are 2657 at the moment.
On Windows, with native Windows python, passing that many sum or log
files to dg-extract-results overflows the command-line length limit
(~32 KB), and the combine step dies.
The .sh wrapper re-execs the faster Python implementation, forwarding
the file list, so the overflow can also surface at the re-exec.
E.g.:
$ make check -j$(nproc)
...
make[1]: Leaving directory '/c/msys2/home/alves/gdb/build-testsuite-windows'
/c/gdb/src/gdb/testsuite/../../contrib/dg-extract-results.sh: line 39: /ucrt64/bin/python3: Argument list too long
/c/gdb/src/gdb/testsuite/../../contrib/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
Fix it by teaching both dg-extract-results.sh and
dg-extract-results.py a new -f option that reads the list of files to
process, one per line, from a named file, or from standard input when
the argument is "-". The option may be given more than once and mixed
with file arguments.
A caller can then pipe the file list straight in via "-f -" instead of
expanding it onto the command line, so the length limit no longer
applies regardless of host or Python flavor.
Existing callers can continue working as they were, as passing the
file list as one file per argument is still supported.
contrib/ChangeLog:
* dg-extract-results.py: Handle new "-f list-file" option.
* dg-extract-results.sh: Ditto.
2 files changed