diff options
author | Alex Coplan <alex.coplan@arm.com> | 2024-08-08 13:15:39 +0000 |
---|---|---|
committer | Alex Coplan <alex.coplan@arm.com> | 2024-09-11 11:50:48 +0100 |
commit | 31ff173c70847bba94613eac5b1ef2c0bec842e6 (patch) | |
tree | 8a3f02cc663b681e906407f19447c4ca8f48fd4d /gcc | |
parent | f97d86242b86e4ad2bef3623c97e91481840a210 (diff) | |
download | gcc-31ff173c70847bba94613eac5b1ef2c0bec842e6.zip gcc-31ff173c70847bba94613eac5b1ef2c0bec842e6.tar.gz gcc-31ff173c70847bba94613eac5b1ef2c0bec842e6.tar.bz2 |
testsuite: Ensure ltrans dump files get cleaned up properly [PR116140]
I noticed while working on a test that uses LTO and requests a dump
file, that we are failing to cleanup ltrans dump files in the testsuite.
E.g. the test I was working on compiles with -flto
-fdump-rtl-loop2_unroll, and we end up with the following file:
./gcc/testsuite/g++/pr116140.ltrans0.ltrans.287r.loop2_unroll
being left behind by the testsuite. This is problematic not just from a
"missing cleanup" POV, but also because it can cause the test to pass
spuriously when the test is re-run wtih an unpatched compiler (without
the bug fix). In the broken case, loop2_unroll isn't run at all, so we
end up scanning the old dumpfile (from the previous test run) and making
the dumpfile scan pass.
Running with `-v -v` in RUNTESTFLAGS we can see the following cleanup
attempt is made:
remove-build-file `pr116140.{C,exe}.{ltrans[0-9]*.,}[0-9][0-9][0-9]{l,i,r,t}.*'
looking again at the ltrans dump file above we can see this will fail for two
reasons:
- The actual dump file has no {C,exe} extension between the basename and
ltrans0.
- The actual dump file has an additional `.ltrans` component after `.ltrans0`.
This patch therefore relaxes the pattern constructed for cleaning up such
dumpfiles to also match dumpfiles with the above form.
Running the testsuite before/after this patch shows the number of files in
gcc/testsuite (in the build dir) with "ltrans" in the name goes from 1416 to 62
on aarch64.
gcc/testsuite/ChangeLog:
PR libstdc++/116140
* lib/gcc-dg.exp (schedule-cleanups): Relax ltrans dumpfile
cleanup pattern to handle missing cases.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/lib/gcc-dg.exp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index d9513e2..cb401a7 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -190,7 +190,7 @@ proc schedule-cleanups { opts } { # Handle ltrans files around -flto if [regexp -- {(^|\s+)-flto(\s+|$)} $opts] { verbose "Cleanup -flto seen" 4 - set ltrans "{ltrans\[0-9\]*.,}" + set ltrans "{ltrans\[0-9\]*{.ltrans,}.,}" } else { set ltrans "" } @@ -206,7 +206,7 @@ proc schedule-cleanups { opts } { if {$basename_ext != ""} { regsub -- {^.*\.} $basename_ext {} basename_ext } - lappend tfiles "$stem.{$basename_ext,exe}" + lappend tfiles "$stem{.$basename_ext,.exe,}" unset basename_ext } else { lappend tfiles $basename |