================
@@ -26,4 +57,37 @@ TEST(SerializationFormatRegistryTest, 
EnumeratingRegistryEntries) {
   EXPECT_EQ(Formats.begin()->getName(), "MockSerializationFormat");
 }
 
+TEST(SerializationFormatRegistryTest, Roundtrip) {
+  StringLiteral FancyAnalysisFileData = "FancyAnalysisData{\n"
+                                        "  SomeInternalList: zed, vayne, lux\n"
+                                        "}\n";
+
+  auto Inputs = makeIntrusiveRefCnt<vfs::InMemoryFileSystem>();
+  Inputs->addFile("input/analyses.txt", /*ModificationTime=*/{},
+                  MemoryBuffer::getMemBufferCopy("FancyAnalysis\n"));
+  Inputs->addFile("input/FancyAnalysis.special", /*ModificationTime=*/{},
+                  MemoryBuffer::getMemBufferCopy(FancyAnalysisFileData));
+
+  std::unique_ptr<SerializationFormat> Format =
+      makeFormat(Inputs, "MockSerializationFormat");
+  ASSERT_TRUE(Format);
+
+  TUSummary LoadedSummary = Format->readTUSummary("input");
+
+  // Create a temporary output directory
+  SmallString<128> OutputDir;
+  std::error_code EC = sys::fs::createUniqueDirectory("ssaf-test", OutputDir);
----------------
aviralg wrote:

It will be simpler to use the filesystem for input files as well. Using the 
InMemoryFileSystem in the test case makes it more mysterious and involved than 
it should be. We can probably present this as an example in the documentation.

https://github.com/llvm/llvm-project/pull/179517
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to