aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/LockFileManagerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/LockFileManagerTest.cpp')
-rw-r--r--llvm/unittests/Support/LockFileManagerTest.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/unittests/Support/LockFileManagerTest.cpp b/llvm/unittests/Support/LockFileManagerTest.cpp
index 552053d..627b2da 100644
--- a/llvm/unittests/Support/LockFileManagerTest.cpp
+++ b/llvm/unittests/Support/LockFileManagerTest.cpp
@@ -9,6 +9,7 @@
#include "llvm/Support/LockFileManager.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
+#include "llvm/Testing/Support/Error.h"
#include "llvm/Testing/Support/SupportHelpers.h"
#include "gtest/gtest.h"
#include <memory>
@@ -27,12 +28,12 @@ TEST(LockFileManagerTest, Basic) {
{
// The lock file should not exist, so we should successfully acquire it.
LockFileManager Locked1(LockedFile);
- EXPECT_EQ(LockFileManager::LFS_Owned, Locked1.getState());
+ EXPECT_THAT_EXPECTED(Locked1.tryLock(), HasValue(true));
// Attempting to reacquire the lock should fail. Waiting on it would cause
// deadlock, so don't try that.
LockFileManager Locked2(LockedFile);
- EXPECT_NE(LockFileManager::LFS_Owned, Locked2.getState());
+ EXPECT_THAT_EXPECTED(Locked2.tryLock(), HasValue(false));
}
// Now that the lock is out of scope, the file should be gone.
@@ -68,7 +69,7 @@ TEST(LockFileManagerTest, LinkLockExists) {
// The lock file doesn't point to a real file, so we should successfully
// acquire it.
LockFileManager Locked(LockedFile);
- EXPECT_EQ(LockFileManager::LFS_Owned, Locked.getState());
+ EXPECT_THAT_EXPECTED(Locked.tryLock(), HasValue(true));
}
// Now that the lock is out of scope, the file should be gone.
@@ -93,7 +94,7 @@ TEST(LockFileManagerTest, RelativePath) {
{
// The lock file should not exist, so we should successfully acquire it.
LockFileManager Locked(LockedFile);
- EXPECT_EQ(LockFileManager::LFS_Owned, Locked.getState());
+ EXPECT_THAT_EXPECTED(Locked.tryLock(), HasValue(true));
EXPECT_TRUE(sys::fs::exists(FileLock.str()));
}