]> granicus.if.org Git - llvm/commitdiff
[Support] Fix unit test for fs::is_local
authorPetar Jovanovic <petar.jovanovic@mips.com>
Wed, 8 May 2019 14:42:13 +0000 (14:42 +0000)
committerPetar Jovanovic <petar.jovanovic@mips.com>
Wed, 8 May 2019 14:42:13 +0000 (14:42 +0000)
Close the temporary file after the test is done using it.
If it is not closed and the file was created on NFS, it will cause the test
to fail. The problem happens in the cleanup process afterwards. It first
tries to delete the file but it is not really deleted. Afterwards, the
program fails to delete the directory containing the file, causing the whole
test to fail.

Patch by Milos Stojanovic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360259 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/Path.cpp

index 750fd13db97dd9c0d4985ebf25294087520d48eb..4eee8e923b73eda2898caf27b2302ff8e5a6458a 100644 (file)
@@ -1517,6 +1517,7 @@ TEST_F(FileSystemTest, is_local) {
   bool TempFileIsLocal;
   ASSERT_NO_ERROR(fs::is_local(FD, TempFileIsLocal));
   EXPECT_EQ(TempFileIsLocal, fs::is_local(FD));
+  ::close(FD);
 
   // Expect that the file and its parent directory are equally local or equally
   // remote.