From 1276b396130a0cdbbb8e6c05a6e43123df18ed60 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 5 Jul 2013 20:14:52 +0000 Subject: Use sys::fs::createTemporaryFile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185719 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Support/Path.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'unittests') diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp index ce335ccc6b..4fc02be5e3 100644 --- a/unittests/Support/Path.cpp +++ b/unittests/Support/Path.cpp @@ -165,7 +165,7 @@ TEST_F(FileSystemTest, Unique) { int FileDescriptor; SmallString<64> TempPath; ASSERT_NO_ERROR( - fs::unique_file("%%-%%-%%-%%.temp", FileDescriptor, TempPath)); + fs::createTemporaryFile("prefix", "temp", FileDescriptor, TempPath)); // The same file should return an identical unique id. uint64_t F1, F2; @@ -177,8 +177,8 @@ TEST_F(FileSystemTest, Unique) { int FileDescriptor2; SmallString<64> TempPath2; ASSERT_NO_ERROR( - fs::unique_file("%%-%%-%%-%%.temp", FileDescriptor2, TempPath2)); - + fs::createTemporaryFile("prefix", "temp", FileDescriptor2, TempPath2)); + uint64_t D; ASSERT_NO_ERROR(fs::getUniqueID(Twine(TempPath2), D)); ASSERT_NE(D, F1); @@ -201,7 +201,7 @@ TEST_F(FileSystemTest, TempFiles) { int FileDescriptor; SmallString<64> TempPath; ASSERT_NO_ERROR( - fs::unique_file("%%-%%-%%-%%.temp", FileDescriptor, TempPath)); + fs::createTemporaryFile("prefix", "temp", FileDescriptor, TempPath)); // Make sure it exists. bool TempFileExists; @@ -211,7 +211,7 @@ TEST_F(FileSystemTest, TempFiles) { // Create another temp tile. int FD2; SmallString<64> TempPath2; - ASSERT_NO_ERROR(fs::unique_file("%%-%%-%%-%%.temp", FD2, TempPath2)); + ASSERT_NO_ERROR(fs::createTemporaryFile("prefix", "temp", FD2, TempPath2)); ASSERT_NE(TempPath.str(), TempPath2.str()); fs::file_status A, B; @@ -369,7 +369,7 @@ TEST_F(FileSystemTest, Permissions) { int FileDescriptor; SmallString<64> TempPath; ASSERT_NO_ERROR( - fs::unique_file("%%-%%-%%-%%.temp", FileDescriptor, TempPath)); + fs::createTemporaryFile("prefix", "temp", FileDescriptor, TempPath)); // Mark file as read-only const fs::perms AllWrite = fs::owner_write|fs::group_write|fs::others_write; @@ -396,7 +396,7 @@ TEST_F(FileSystemTest, FileMapping) { int FileDescriptor; SmallString<64> TempPath; ASSERT_NO_ERROR( - fs::unique_file("%%-%%-%%-%%.temp", FileDescriptor, TempPath)); + fs::createTemporaryFile("prefix", "temp", FileDescriptor, TempPath)); // Map in temp file and add some content error_code EC; StringRef Val("hello there"); -- cgit v1.2.3