]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Polish 'dg-output-file' test logs
authorThomas Schwinge <tschwinge@baylibre.com>
Sun, 13 Apr 2025 14:50:37 +0000 (16:50 +0200)
committerThomas Schwinge <tschwinge@baylibre.com>
Mon, 14 Apr 2025 21:50:18 +0000 (23:50 +0200)
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.

gcc/testsuite/lib/gcc-dg.exp

index eadc1cd90bcbc099355b9a404494936133e21191..6dd8fa3fce9c46a237438445f3ae06d89f55e265 100644 (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]