Skip to content

Commit 1224e8d

Browse files
committed
Improve reliability of testcase on Windows by using a different cache
directory each time.
1 parent 9831f4a commit 1224e8d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/unittests/Support/Caching.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ using namespace llvm;
2929
char data[] = "some data";
3030

3131
TEST(Caching, Normal) {
32-
SmallString<256> TempDir;
33-
sys::path::system_temp_directory(true, TempDir);
3432
SmallString<256> CacheDir;
35-
sys::path::append(CacheDir, TempDir, "llvm_test_cache");
33+
sys::fs::createUniquePath("llvm_test_cache-%%%%%%", CacheDir, true);
3634

3735
sys::fs::remove_directories(CacheDir.str());
3836

@@ -78,10 +76,8 @@ TEST(Caching, Normal) {
7876
}
7977

8078
TEST(Caching, WriteAfterCommit) {
81-
SmallString<256> TempDir;
82-
sys::path::system_temp_directory(true, TempDir);
8379
SmallString<256> CacheDir;
84-
sys::path::append(CacheDir, TempDir, "llvm_test_cache");
80+
sys::fs::createUniquePath("llvm_test_cache-%%%%%%", CacheDir, true);
8581

8682
sys::fs::remove_directories(CacheDir.str());
8783

@@ -117,10 +113,8 @@ TEST(Caching, WriteAfterCommit) {
117113
}
118114

119115
TEST(Caching, NoCommit) {
120-
SmallString<256> TempDir;
121-
sys::path::system_temp_directory(true, TempDir);
122116
SmallString<256> CacheDir;
123-
sys::path::append(CacheDir, TempDir, "llvm_test_cache");
117+
sys::fs::createUniquePath("llvm_test_cache-%%%%%%", CacheDir, true);
124118

125119
sys::fs::remove_directories(CacheDir.str());
126120

0 commit comments

Comments
 (0)