Polish 'dg-output-file' test logs

Per commit r15-8260-g563e6d926d9826d76895086d0c40a29dc90d66e5
"testsuite: Add support for dg-output-file directive", this currently produces
test logs as follows:

    PASS: gcc.dg/dg-output-file-1.c (test for excess errors)
    PASS: dg-output-file-1-lp64.txt output file test
    PASS: gcc.dg/dg-output-file-1.c execution test

    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  (test for excess errors)
    PASS: COMP-6_arithmetic.out output file test
    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  execution test
    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  (test for excess errors)
    PASS: COMP-6_arithmetic.out output file test
    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  execution test
    [Etc.]

Notice that the 'PASS: [...] output file test' lines easily produce duplicate
test names, or might even produce PASS plus FAIL for the same test names.

Make the "output file test" use the same "descriptive name" as the other parts,
and get properly sorted with parallel-testing 'contrib/dg-extract-results.sh'
processing:

     PASS: c-c++-common/zero-scratch-regs-leafy-2.c  -Wc++-compat  (test for excess errors)
    -PASS: dg-output-file-1-lp64.txt output file test
     PASS: gcc.dg/20000108-1.c (test for excess errors)
    [...]
     PASS: gcc.dg/devnull-dump.c (test for excess errors)
     PASS: gcc.dg/dg-output-file-1.c (test for excess errors)
     PASS: gcc.dg/dg-output-file-1.c execution test
    +PASS: gcc.dg/dg-output-file-1.c output file test
     PASS: gcc.dg/dg-test-1.c (test for excess errors)

..., and gets de-duplicated test names, for example:

     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  (test for excess errors)
    -PASS: COMP-6_arithmetic.out output file test
    +PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0   output file test
     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  execution test
     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  (test for excess errors)
    -PASS: COMP-6_arithmetic.out output file test
    +PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1   output file test
     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  execution test
    [Etc.]

(Given that only ever a single 'dg-output-file' directive is active, don't
print the output filename.)

	gcc/testsuite/
	* lib/gcc-dg.exp (${tool}_load): Polish 'dg-output-file' test
	logs.
This commit is contained in:
Thomas Schwinge 2025-04-13 16:50:37 +02:00
parent ebdf92b606
commit 8621554d96

View file

@ -507,8 +507,7 @@ if { [info procs ${tool}_load] != [list] \
set linenum 1
set outfile [open [lindex ${output-file} 1]]
set do_fail 0
set name [file tail [lindex ${output-file} 1]]
verbose "output-file args is $args program is $program" 1
set name [testname-for-summary]
while { [gets $outfile line] >= 0 } {
if { $linenum != 1 } {
set c [string index $output $idx]