<div dir="ltr">Hi Jan,<div><br></div><div>One of these tests is failing on a bot:</div><div><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32749">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32749</a></div><br>[ RUN      ] YAMLVFSWriterTest.HandleRootAsVPath<br>Assertion failed: sys::path::is_absolute(RealPath) && "real path not absolute", file C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm-project\llvm\lib\Support\VirtualFileSystem.cpp, line 1918<br><br><div>Please could you take a look?</div><div><br></div><div>Thanks</div><div>Russ</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 4 Jun 2020 at 09:26, Jan Korous via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Jan Korous<br>
Date: 2020-06-04T01:26:12-07:00<br>
New Revision: 30949926f98576fbff8d5ad0390be5124ffacd7e<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/30949926f98576fbff8d5ad0390be5124ffacd7e" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/30949926f98576fbff8d5ad0390be5124ffacd7e</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/30949926f98576fbff8d5ad0390be5124ffacd7e.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/30949926f98576fbff8d5ad0390be5124ffacd7e.diff</a><br>
<br>
LOG: Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2<br>
<br>
This reverts commit e4e3e41905d182c0f3d5b0b9406e3cbf2aabb30f.<br>
<br>
Fixed dangling StringRef in test.<br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    llvm/unittests/Support/VirtualFileSystemTest.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp<br>
index 85e7093514b3..96092de2345b 100644<br>
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp<br>
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp<br>
@@ -2338,3 +2338,60 @@ TEST_F(VFSFromYAMLTest, YAMLVFSWriterTestHandleDirs) {<br>
   EXPECT_FALSE(FS->exists(_b.Path + "/b"));<br>
   EXPECT_FALSE(FS->exists(_c.Path + "/c"));<br>
 }<br>
+<br>
+TEST_F(VFSFromYAMLTest, YAMLVFSWriterTestNestedDirs) {<br>
+  ScopedDir TestDirectory("virtual-file-system-test", /*Unique*/ true);<br>
+  ScopedDir a(TestDirectory + "/a");<br>
+  ScopedDir _a_aa(TestDirectory + "/a/aa");<br>
+  ScopedDir b(TestDirectory + "/b");<br>
+  ScopedDir _b_bb(TestDirectory + "/b/bb");<br>
+  ScopedDir c(TestDirectory + "/c");<br>
+  ScopedDir _c_cc(TestDirectory + "/c/cc");<br>
+<br>
+  vfs::YAMLVFSWriter VFSWriter;<br>
+  VFSWriter.addDirectoryMapping(a.Path, "//root/a");<br>
+  VFSWriter.addDirectoryMapping(_a_aa.Path, "//root/a/aa");<br>
+  VFSWriter.addDirectoryMapping(b.Path, "//root/b");<br>
+  VFSWriter.addDirectoryMapping(_b_bb.Path, "//root/b/bb");<br>
+  VFSWriter.addDirectoryMapping(c.Path, "//root/c");<br>
+  VFSWriter.addDirectoryMapping(_c_cc.Path, "//root/c/cc");<br>
+<br>
+  std::string Buffer;<br>
+  raw_string_ostream OS(Buffer);<br>
+  VFSWriter.write(OS);<br>
+  OS.flush();<br>
+<br>
+  IntrusiveRefCntPtr<ErrorDummyFileSystem> Lower(new ErrorDummyFileSystem());<br>
+  Lower->addDirectory("//root/a");<br>
+  Lower->addDirectory("//root/a/aa");<br>
+  Lower->addDirectory("//root/b");<br>
+  Lower->addDirectory("//root/b/bb");<br>
+  Lower->addDirectory("//root/c");<br>
+  Lower->addDirectory("//root/c/cc");<br>
+<br>
+  IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLRawString(Buffer, Lower);<br>
+  ASSERT_TRUE(FS.get() != nullptr);<br>
+<br>
+  EXPECT_TRUE(FS->exists(a.Path));<br>
+  EXPECT_TRUE(FS->exists(_a_aa.Path));<br>
+  EXPECT_TRUE(FS->exists(b.Path));<br>
+  EXPECT_TRUE(FS->exists(_b_bb.Path));<br>
+  EXPECT_TRUE(FS->exists(c.Path));<br>
+  EXPECT_TRUE(FS->exists(_c_cc.Path));<br>
+}<br>
+<br>
+TEST(YAMLVFSWriterTest, HandleRootAsVPath) {<br>
+  llvm::SmallVector<char, 32> Tmp;<br>
+  llvm::sys::path::system_temp_directory(false, Tmp);<br>
+  std::string Root = llvm::sys::path::root_path(StringRef(Tmp.data(), Tmp.size())).str();<br>
+  llvm::SmallVector<char, 32> Subdir(Root.begin(), Root.end());<br>
+  llvm::sys::path::append(Subdir, "foo");<br>
+<br>
+  llvm::vfs::YAMLVFSWriter W;<br>
+  W.addDirectoryMapping(Root, "/tmp");<br>
+  W.addDirectoryMapping(std::string{Subdir.begin(), Subdir.end()} + "/foo", "/tmp/bar");<br>
+  std::string Dump;<br>
+  llvm::raw_string_ostream ToBeIgnored(Dump);<br>
+<br>
+  EXPECT_NO_FATAL_FAILURE(W.write(ToBeIgnored));<br>
+}<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>