Some LLVM unit tests forget to clean up the temporary files and directories.
Use existing RAII classes for cleaning them up, remove duplicated code (ScopedDir, ScopedFile, ScopedLink classes) by extracting it into a common header file.
Paths
| Differential D83228
[llvm] [unittests] Remove some temporary files after they're not needed ClosedPublic Authored by broadwaylamb on Jul 6 2020, 7:26 AM.
Details Summary Some LLVM unit tests forget to clean up the temporary files and directories. Use existing RAII classes for cleaning them up, remove duplicated code (ScopedDir, ScopedFile, ScopedLink classes) by extracting it into a common header file.
Diff Detail
Event TimelineComment Actions Thanks, I think these will be useful helpers to have! I think we do need to consider the API though, rather than being too anchored on the existing callsites.
Comment Actions Address review comments, change some tests that didn't use the RAII objects to use them where appropriate. Comment Actions Sorry, this fell off my radar :-(
This revision is now accepted and ready to land.Aug 31 2020, 5:23 AM
This revision was landed with ongoing or failed builds.Sep 1 2020, 2:35 PM Closed by commit rGfad75598d272: [llvm] [unittests] Remove temporary files after they're not needed (authored by broadwaylamb). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 289287 llvm/include/llvm/Testing/Support/SupportHelpers.h
llvm/unittests/ProfileData/SampleProfTest.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/FileCollectorTest.cpp
llvm/unittests/Support/FileUtilitiesTest.cpp
llvm/unittests/Support/LockFileManagerTest.cpp
llvm/unittests/Support/TarWriterTest.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp
llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp
|
the bool param that changes the meaning of the previous param is a little cryptic (including at callsites).
It also makes the common case of "unique temporary directory that I don't care about the name of
You could consider TempDir(Name) and TempDir::unique(). (Specifying the model doesn't seem all that useful?).
Up to you.