[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
This commit is contained in:
Petar Jovanovic 2019-05-08 14:42:13 +00:00
parent 5b6dda33d1
commit 4964e3837e
1 changed files with 1 additions and 0 deletions

View 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.