diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-04-13 17:59:30 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-04-13 17:59:30 +0000 |
commit | 324243fa90e199012a81bf08b232a9d523ce1fbf (patch) | |
tree | 53672f78e6aa533d02d111a045bfd50de7af8c49 /test/common | |
parent | f735627dd3e7c9ef6773afac671b7bf7ec4bf16c (diff) |
Fix file locking on Windows.
NamedLock simply didn't work before. This may cause test failures, but the
tests are already failing on Windows, and must be fixed.
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/testcommon.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp index 076099ad..fbdf8d9c 100644 --- a/test/common/testcommon.cpp +++ b/test/common/testcommon.cpp @@ -262,6 +262,18 @@ int test(int argc, const char *argv[]) TEST_THAT(!TestFileExists(tempfile.c_str())); } + // Test that named locks work as expected + { + NamedLock lock1; + TEST_THAT(lock1.TryAndGetLock("testfiles/locktest")); + // With a lock held, we should not be able to acquire another. + TEST_THAT(!NamedLock().TryAndGetLock("testfiles/locktest")); + } + { + // But with the lock released, we should be able to. + TEST_THAT(NamedLock().TryAndGetLock("testfiles/locktest")); + } + // Test that memory leak detection doesn't crash { char *test = new char[1024]; |