Add a convenience createUniqueDirectory function.

There are a few valid situation where we care about the structure inside a
directory, but not about the directory itself. A simple example is for unit
testing directory traversal.

PathV1 had a function like this, add one to V2 and port existing users of the
created temp file and delete it hack to using it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185059 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-06-27 03:45:31 +00:00
parent e2b9912a78
commit 08ddd12e44
4 changed files with 20 additions and 12 deletions

View File

@ -30,12 +30,8 @@ TEST(FileOutputBuffer, Test) {
// Create unique temporary directory for these tests
SmallString<128> TestDirectory;
{
int fd;
ASSERT_NO_ERROR(
fs::unique_file("FileOutputBuffer-test-%%-%%-%%-%%/dir", fd,
TestDirectory));
::close(fd);
TestDirectory = path::parent_path(TestDirectory);
fs::createUniqueDirectory("FileOutputBuffer-test", TestDirectory));
}
// TEST 1: Verify commit case.