summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/Path.cpp
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@mips.com>2019-05-08 14:42:13 +0000
committerPetar Jovanovic <petar.jovanovic@mips.com>2019-05-08 14:42:13 +0000
commit4964e3837e406e6375488fd9ecad82bea2a1881b (patch)
tree9de7badfc8f42d8f7f2104f7450986f9d9c0aa3b /llvm/unittests/Support/Path.cpp
parent5b6dda33d1227e9f9c2a3ec8464a7ddd90df45d2 (diff)
downloadbcm5719-llvm-4964e3837e406e6375488fd9ecad82bea2a1881b.tar.gz
bcm5719-llvm-4964e3837e406e6375488fd9ecad82bea2a1881b.zip
[Support] Fix unit test for fs::is_local
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. llvm-svn: 360259
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r--llvm/unittests/Support/Path.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 750fd13db97..4eee8e923b7 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -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.
OpenPOWER on IntegriCloud