Author: Kadir Cetinkaya Date: 2023-06-06T15:45:55+02:00 New Revision: 476e7c49ecb762df1d68273696b06c36feb0fd96
URL: https://github.com/llvm/llvm-project/commit/476e7c49ecb762df1d68273696b06c36feb0fd96 DIFF: https://github.com/llvm/llvm-project/commit/476e7c49ecb762df1d68273696b06c36feb0fd96.diff LOG: [clang][test] Use a physical copy of FS Make use of a physical copy, rather than real FS in unittests that change working-directory to get rid of the side effect of changing cwd for the whole process. It's triggering crashes depending on the test order. Differential Revision: https://reviews.llvm.org/D152265 Added: Modified: clang/unittests/Serialization/ModuleCacheTest.cpp clang/unittests/Serialization/NoCommentsTest.cpp clang/unittests/Serialization/VarDeclConstantInitTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Serialization/ModuleCacheTest.cpp b/clang/unittests/Serialization/ModuleCacheTest.cpp index 268b037179851..1e152a399c218 100644 --- a/clang/unittests/Serialization/ModuleCacheTest.cpp +++ b/clang/unittests/Serialization/ModuleCacheTest.cpp @@ -14,6 +14,7 @@ #include "clang/Lex/HeaderSearch.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" @@ -98,6 +99,7 @@ TEST_F(ModuleCacheTest, CachedModuleNewPath) { CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); // First run should pass with no errors const char *Args[] = {"clang", "-fmodules", "-Fframeworks", diff --git a/clang/unittests/Serialization/NoCommentsTest.cpp b/clang/unittests/Serialization/NoCommentsTest.cpp index 48f76bbd9d5f8..2632a6337807a 100644 --- a/clang/unittests/Serialization/NoCommentsTest.cpp +++ b/clang/unittests/Serialization/NoCommentsTest.cpp @@ -87,6 +87,7 @@ void foo() {} CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); std::string CacheBMIPath = llvm::Twine(TestDir + "/Comments.pcm").str(); const char *Args[] = { diff --git a/clang/unittests/Serialization/VarDeclConstantInitTest.cpp b/clang/unittests/Serialization/VarDeclConstantInitTest.cpp index 33fc82b9adc75..86ae929e7f17e 100644 --- a/clang/unittests/Serialization/VarDeclConstantInitTest.cpp +++ b/clang/unittests/Serialization/VarDeclConstantInitTest.cpp @@ -94,6 +94,7 @@ export namespace Fibonacci CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); std::string CacheBMIPath = llvm::Twine(TestDir + "/Cached.pcm").str(); const char *Args[] = { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits