[PATCH] D149760: [llvm][test] Skip physical filesystem test if unsupported

Ben Langmuir via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 09:21:31 PDT 2023


benlangmuir created this revision.
benlangmuir added a reviewer: ro.
Herald added a subscriber: fedor.sergeev.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We are relying on deleting the working directory to trigger a later error in getcwd, but some platforms (e.g. Solaris) disallow deleting the working directory of the process. Skip the test in that case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149760

Files:
  llvm/unittests/Support/VirtualFileSystemTest.cpp


Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===================================================================
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -537,7 +537,9 @@
       llvm::make_scope_exit([&] { sys::fs::set_current_path(PrevWD); });
 
   // Delete the working directory to create an error.
-  ASSERT_EQ(sys::fs::remove_directories(WD), std::error_code());
+  if (sys::fs::remove_directories(WD, /*IgnoreErrors=*/false))
+    // Some platforms (e.g. Solaris) disallow removal of the working directory.
+    GTEST_SKIP() << "test requires deletion of working directory";
 
   // Verify that we still get two separate working directories.
   auto FS1 = vfs::createPhysicalFileSystem();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149760.519111.patch
Type: text/x-patch
Size: 774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230503/92fc9b6d/attachment.bin>


More information about the llvm-commits mailing list