Piotr Caban : msvcr100: Add _ReentrantBlockingLock tests.

Alexandre Julliard julliard at winehq.org
Mon Feb 27 15:12:09 CST 2017


Module: wine
Branch: master
Commit: 0e7fa9006807fb95b28bf3ac9088614371463a81
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0e7fa9006807fb95b28bf3ac9088614371463a81

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Feb 27 18:16:17 2017 +0100

msvcr100: Add _ReentrantBlockingLock tests.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcr100/tests/msvcr100.c | 66 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/dlls/msvcr100/tests/msvcr100.c b/dlls/msvcr100/tests/msvcr100.c
index 045d698..cdac1b9 100644
--- a/dlls/msvcr100/tests/msvcr100.c
+++ b/dlls/msvcr100/tests/msvcr100.c
@@ -134,6 +134,10 @@ typedef struct
     yield_func yield_func;
 } SpinWait;
 
+typedef struct {
+    CRITICAL_SECTION cs;
+} _ReentrantBlockingLock;
+
 static int* (__cdecl *p_errno)(void);
 static int (__cdecl *p_wmemcpy_s)(wchar_t *dest, size_t numberOfElements, const wchar_t *src, size_t count);
 static int (__cdecl *p_wmemmove_s)(wchar_t *dest, size_t numberOfElements, const wchar_t *src, size_t count);
@@ -163,6 +167,17 @@ static void (__thiscall *preader_writer_lock_unlock)(void*);
 static MSVCRT_bool (__thiscall *preader_writer_lock_try_lock)(void*);
 static MSVCRT_bool (__thiscall *preader_writer_lock_try_lock_read)(void*);
 
+static _ReentrantBlockingLock* (__thiscall *p_ReentrantBlockingLock_ctor)(_ReentrantBlockingLock*);
+static void (__thiscall *p_ReentrantBlockingLock_dtor)(_ReentrantBlockingLock*);
+static void (__thiscall *p_ReentrantBlockingLock__Acquire)(_ReentrantBlockingLock*);
+static void (__thiscall *p_ReentrantBlockingLock__Release)(_ReentrantBlockingLock*);
+static MSVCRT_bool (__thiscall *p_ReentrantBlockingLock__TryAcquire)(_ReentrantBlockingLock*);
+static _ReentrantBlockingLock* (__thiscall *p_NonReentrantBlockingLock_ctor)(_ReentrantBlockingLock*);
+static void (__thiscall *p_NonReentrantBlockingLock_dtor)(_ReentrantBlockingLock*);
+static void (__thiscall *p_NonReentrantBlockingLock__Acquire)(_ReentrantBlockingLock*);
+static void (__thiscall *p_NonReentrantBlockingLock__Release)(_ReentrantBlockingLock*);
+static MSVCRT_bool (__thiscall *p_NonReentrantBlockingLock__TryAcquire)(_ReentrantBlockingLock*);
+
 /* make sure we use the correct errno */
 #undef errno
 #define errno (*p_errno())
@@ -211,6 +226,17 @@ static BOOL init(void)
         SET(preader_writer_lock_unlock, "?unlock at reader_writer_lock@Concurrency@@QEAAXXZ");
         SET(preader_writer_lock_try_lock, "?try_lock at reader_writer_lock@Concurrency@@QEAA_NXZ");
         SET(preader_writer_lock_try_lock_read, "?try_lock_read at reader_writer_lock@Concurrency@@QEAA_NXZ");
+
+        SET(p_ReentrantBlockingLock_ctor, "??0_ReentrantBlockingLock at details@Concurrency@@QEAA at XZ");
+        SET(p_ReentrantBlockingLock_dtor, "??1_ReentrantBlockingLock at details@Concurrency@@QEAA at XZ");
+        SET(p_ReentrantBlockingLock__Acquire, "?_Acquire at _ReentrantBlockingLock@details at Concurrency@@QEAAXXZ");
+        SET(p_ReentrantBlockingLock__Release, "?_Release at _ReentrantBlockingLock@details at Concurrency@@QEAAXXZ");
+        SET(p_ReentrantBlockingLock__TryAcquire, "?_TryAcquire at _ReentrantBlockingLock@details at Concurrency@@QEAA_NXZ");
+        SET(p_NonReentrantBlockingLock_ctor, "??0_NonReentrantBlockingLock at details@Concurrency@@QEAA at XZ");
+        SET(p_NonReentrantBlockingLock_dtor, "??1_NonReentrantBlockingLock at details@Concurrency@@QEAA at XZ");
+        SET(p_NonReentrantBlockingLock__Acquire, "?_Acquire at _NonReentrantBlockingLock@details at Concurrency@@QEAAXXZ");
+        SET(p_NonReentrantBlockingLock__Release, "?_Release at _NonReentrantBlockingLock@details at Concurrency@@QEAAXXZ");
+        SET(p_NonReentrantBlockingLock__TryAcquire, "?_TryAcquire at _NonReentrantBlockingLock@details at Concurrency@@QEAA_NXZ");
     } else {
         SET(pSpinWait_ctor_yield, "??0?$_SpinWait@$00 at details@Concurrency@@QAE at P6AXXZ@Z");
         SET(pSpinWait_dtor, "??_F?$_SpinWait@$00 at details@Concurrency@@QAEXXZ");
@@ -227,6 +253,17 @@ static BOOL init(void)
         SET(preader_writer_lock_unlock, "?unlock at reader_writer_lock@Concurrency@@QAEXXZ");
         SET(preader_writer_lock_try_lock, "?try_lock at reader_writer_lock@Concurrency@@QAE_NXZ");
         SET(preader_writer_lock_try_lock_read, "?try_lock_read at reader_writer_lock@Concurrency@@QAE_NXZ");
+
+        SET(p_ReentrantBlockingLock_ctor, "??0_ReentrantBlockingLock at details@Concurrency@@QAE at XZ");
+        SET(p_ReentrantBlockingLock_dtor, "??1_ReentrantBlockingLock at details@Concurrency@@QAE at XZ");
+        SET(p_ReentrantBlockingLock__Acquire, "?_Acquire at _ReentrantBlockingLock@details at Concurrency@@QAEXXZ");
+        SET(p_ReentrantBlockingLock__Release, "?_Release at _ReentrantBlockingLock@details at Concurrency@@QAEXXZ");
+        SET(p_ReentrantBlockingLock__TryAcquire, "?_TryAcquire at _ReentrantBlockingLock@details at Concurrency@@QAE_NXZ");
+        SET(p_NonReentrantBlockingLock_ctor, "??0_NonReentrantBlockingLock at details@Concurrency@@QAE at XZ");
+        SET(p_NonReentrantBlockingLock_dtor, "??1_NonReentrantBlockingLock at details@Concurrency@@QAE at XZ");
+        SET(p_NonReentrantBlockingLock__Acquire, "?_Acquire at _NonReentrantBlockingLock@details at Concurrency@@QAEXXZ");
+        SET(p_NonReentrantBlockingLock__Release, "?_Release at _NonReentrantBlockingLock@details at Concurrency@@QAEXXZ");
+        SET(p_NonReentrantBlockingLock__TryAcquire, "?_TryAcquire at _NonReentrantBlockingLock@details at Concurrency@@QAE_NXZ");
     }
 
     init_thiscall_thunk();
@@ -640,6 +677,34 @@ static void test_reader_writer_lock(void)
     call_func1(preader_writer_lock_dtor, rw_lock);
 }
 
+static void test__ReentrantBlockingLock(void)
+{
+    _ReentrantBlockingLock rbl;
+    MSVCRT_bool ret;
+
+    call_func1(p_ReentrantBlockingLock_ctor, &rbl);
+    ret = call_func1(p_ReentrantBlockingLock__TryAcquire, &rbl);
+    ok(ret, "_ReentrantBlockingLock__TryAcquire failed\n");
+    call_func1(p_ReentrantBlockingLock__Acquire, &rbl);
+    ret = call_func1(p_ReentrantBlockingLock__TryAcquire, &rbl);
+    ok(ret, "_ReentrantBlockingLock__TryAcquire failed\n");
+    call_func1(p_ReentrantBlockingLock__Release, &rbl);
+    call_func1(p_ReentrantBlockingLock__Release, &rbl);
+    call_func1(p_ReentrantBlockingLock__Release, &rbl);
+    call_func1(p_ReentrantBlockingLock_dtor, &rbl);
+
+    call_func1(p_NonReentrantBlockingLock_ctor, &rbl);
+    ret = call_func1(p_NonReentrantBlockingLock__TryAcquire, &rbl);
+    ok(ret, "_NonReentrantBlockingLock__TryAcquire failed\n");
+    call_func1(p_NonReentrantBlockingLock__Acquire, &rbl);
+    ret = call_func1(p_NonReentrantBlockingLock__TryAcquire, &rbl);
+    ok(ret, "_NonReentrantBlockingLock__TryAcquire failed\n");
+    call_func1(p_NonReentrantBlockingLock__Release, &rbl);
+    call_func1(p_NonReentrantBlockingLock__Release, &rbl);
+    call_func1(p_NonReentrantBlockingLock__Release, &rbl);
+    call_func1(p_NonReentrantBlockingLock_dtor, &rbl);
+}
+
 START_TEST(msvcr100)
 {
     if (!init())
@@ -652,4 +717,5 @@ START_TEST(msvcr100)
     test_atoi();
     test__SpinWait();
     test_reader_writer_lock();
+    test__ReentrantBlockingLock();
 }




More information about the wine-cvs mailing list