Skip to content

Commit

Permalink
[llvm][test] Skip physical filesystem test if unsupported
Browse files Browse the repository at this point in the history
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.

Differential Revision: https://reviews.llvm.org/D149760
  • Loading branch information
benlangmuir committed May 3, 2023
1 parent 8fe8d69 commit 562cd31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llvm/unittests/Support/VirtualFileSystemTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,9 @@ TEST(VirtualFileSystemTest, PhysicalFileSystemWorkingDirFailure) {
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();
Expand Down

0 comments on commit 562cd31

Please sign in to comment.