Author: greatlrd Date: Sun Jun 1 12:33:51 2008 New Revision: 33816
URL: http://svn.reactos.org/svn/reactos?rev=33816&view=rev Log: Adding complete test kit for EngCreateSemaphore, EngAcquireSemaphore, EngDeleteSemaphore, EngReleaseSemaphore I think it testing all case it can now, and also split up some test to EngDeleteSemaphore and EngReleaseSemaphore and EngAcquireSemaphore, that was in EngCreateSemaphore
Added: trunk/rostests/apitests/gdi32api/tests/EngAcquireSemaphore.c (with props) trunk/rostests/apitests/gdi32api/tests/EngDeleteSemaphore.c (with props) trunk/rostests/apitests/gdi32api/tests/EngReleaseSemaphore.c (with props) Modified: trunk/rostests/apitests/gdi32api/testlist.c trunk/rostests/apitests/gdi32api/tests/EngCreateSemaphore.c
Modified: trunk/rostests/apitests/gdi32api/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/testlist... ============================================================================== --- trunk/rostests/apitests/gdi32api/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32api/testlist.c [iso-8859-1] Sun Jun 1 12:33:51 2008 @@ -12,6 +12,9 @@ #include "tests/CreatePen.c" #include "tests/CreateRectRgn.c" #include "tests/EngCreateSemaphore.c" +#include "tests/EngAcquireSemaphore.c" +#include "tests/EngDeleteSemaphore.c" +#include "tests/EngReleaseSemaphore.c" #include "tests/ExtCreatePen.c" #include "tests/GdiConvertBitmap.c" #include "tests/GdiConvertBrush.c" @@ -53,6 +56,9 @@ { L"CreateFont", Test_CreateFont }, { L"CreatePen", Test_CreatePen }, { L"EngCreateSemaphore", Test_EngCreateSemaphore }, + { L"EngAcquireSemaphore", Test_EngAcquireSemaphore }, + { L"EngDeleteSemaphore", Test_EngDeleteSemaphore }, + { L"EngReleaseSemaphore", Test_EngReleaseSemaphore }, { L"CreateRectRgn", Test_CreateRectRgn }, { L"ExtCreatePen", Test_ExtCreatePen }, { L"GdiConvertBitmap", Test_GdiConvertBitmap },
Added: trunk/rostests/apitests/gdi32api/tests/EngAcquireSemaphore.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/En... ============================================================================== --- trunk/rostests/apitests/gdi32api/tests/EngAcquireSemaphore.c (added) +++ trunk/rostests/apitests/gdi32api/tests/EngAcquireSemaphore.c [iso-8859-1] Sun Jun 1 12:33:51 2008 @@ -1,0 +1,45 @@ +/* Simple test of EngAcquireSemaphore only check if we got a lock or not */ +INT +Test_EngAcquireSemaphore(PTESTINFO pti) +{ + + HSEMAPHORE hsem; + PRTL_CRITICAL_SECTION lpcrit; + + hsem = EngCreateSemaphore(); + RTEST ( hsem != NULL ); + ASSERT(hsem != NULL); + lpcrit = (PRTL_CRITICAL_SECTION) hsem; + + /* real data test */ + EngAcquireSemaphore(hsem); + RTEST (lpcrit->LockCount == -2); + RTEST (lpcrit->RecursionCount == 1); + RTEST (lpcrit->OwningThread != 0); + RTEST (lpcrit->LockSemaphore == 0); + RTEST (lpcrit->SpinCount == 0); + + ASSERT(lpcrit->DebugInfo != NULL); + RTEST (lpcrit->DebugInfo->Type == 0); + RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex == 0); + RTEST (lpcrit->DebugInfo->EntryCount == 0); + RTEST (lpcrit->DebugInfo->ContentionCount == 0); + + EngReleaseSemaphore(hsem); + EngDeleteSemaphore(hsem); + + /* NULL pointer test */ + // Note NULL pointer test crash in Vista */ + // EngAcquireSemaphore(NULL); + + /* negtive pointer test */ + // Note negtive pointer test crash in Vista */ + // EngAcquireSemaphore((HSEMAPHORE)-1); + + /* try with deleted Semaphore */ + // Note deleted Semaphore pointer test does freze the whole program in Vista */ + // EngAcquireSemaphore(hsem); + + return APISTATUS_NORMAL; +} +
Propchange: trunk/rostests/apitests/gdi32api/tests/EngAcquireSemaphore.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/apitests/gdi32api/tests/EngCreateSemaphore.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/En... ============================================================================== --- trunk/rostests/apitests/gdi32api/tests/EngCreateSemaphore.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32api/tests/EngCreateSemaphore.c [iso-8859-1] Sun Jun 1 12:33:51 2008 @@ -26,21 +26,6 @@
EngDeleteSemaphore(hsem);
- RTEST (lpcrit->DebugInfo != NULL); - RTEST (lpcrit->LockCount > 0); - RTEST (lpcrit->RecursionCount == 0); - RTEST (lpcrit->OwningThread == 0); - RTEST (lpcrit->LockSemaphore == 0); - RTEST (lpcrit->SpinCount == 0); - - ASSERT(lpcrit->DebugInfo != NULL); - // my (magnus olsen) value I getting back in vista RTEST (lpcrit->DebugInfo->Type == 0xA478); - RTEST (lpcrit->DebugInfo->Type != 0); - RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0); - RTEST (lpcrit->DebugInfo->EntryCount != 0); - // my (magnus olsen) value I getting back RTEST in vista (lpcrit->DebugInfo->ContentionCount == 0x20000); - RTEST (lpcrit->DebugInfo->ContentionCount != 0); - return APISTATUS_NORMAL; }
Added: trunk/rostests/apitests/gdi32api/tests/EngDeleteSemaphore.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/En... ============================================================================== --- trunk/rostests/apitests/gdi32api/tests/EngDeleteSemaphore.c (added) +++ trunk/rostests/apitests/gdi32api/tests/EngDeleteSemaphore.c [iso-8859-1] Sun Jun 1 12:33:51 2008 @@ -1,0 +1,51 @@ + +INT +Test_EngDeleteSemaphore(PTESTINFO pti) +{ + + HSEMAPHORE hsem; + PRTL_CRITICAL_SECTION lpcrit; + + /* test Create then delete */ + hsem = EngCreateSemaphore(); + ASSERT(hsem != NULL); + lpcrit = (PRTL_CRITICAL_SECTION) hsem; + EngDeleteSemaphore(hsem); + + RTEST (lpcrit->LockCount > 0); + RTEST (lpcrit->RecursionCount == 0); + RTEST (lpcrit->OwningThread == 0); + RTEST (lpcrit->LockSemaphore == 0); + RTEST (lpcrit->SpinCount == 0); + + ASSERT(lpcrit->DebugInfo != NULL); + RTEST (lpcrit->DebugInfo->Type != 0); + RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0); + RTEST (lpcrit->DebugInfo->EntryCount != 0); + RTEST (lpcrit->DebugInfo->ContentionCount != 0); + + + /* test EngAcquireSemaphore and release it, then delete it */ + hsem = EngCreateSemaphore(); + ASSERT(hsem != NULL); + lpcrit = (PRTL_CRITICAL_SECTION) hsem; + + EngAcquireSemaphore(hsem); + EngReleaseSemaphore(hsem); + EngDeleteSemaphore(hsem); + + RTEST (lpcrit->LockCount > 0); + RTEST (lpcrit->RecursionCount == 0); + RTEST (lpcrit->OwningThread == 0); + RTEST (lpcrit->LockSemaphore == 0); + RTEST (lpcrit->SpinCount == 0); + + ASSERT(lpcrit->DebugInfo != NULL); + RTEST (lpcrit->DebugInfo->Type != 0); + RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0); + RTEST (lpcrit->DebugInfo->EntryCount != 0); + RTEST (lpcrit->DebugInfo->ContentionCount != 0); + + return APISTATUS_NORMAL; +} +
Propchange: trunk/rostests/apitests/gdi32api/tests/EngDeleteSemaphore.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/apitests/gdi32api/tests/EngReleaseSemaphore.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/En... ============================================================================== --- trunk/rostests/apitests/gdi32api/tests/EngReleaseSemaphore.c (added) +++ trunk/rostests/apitests/gdi32api/tests/EngReleaseSemaphore.c [iso-8859-1] Sun Jun 1 12:33:51 2008 @@ -1,0 +1,56 @@ +/* Simple test of EngAcquireSemaphore only check if we got a lock or not */ +INT +Test_EngReleaseSemaphore(PTESTINFO pti) +{ + + HSEMAPHORE hsem; + PRTL_CRITICAL_SECTION lpcrit; + + hsem = EngCreateSemaphore(); + ASSERT(hsem != NULL); + + lpcrit = (PRTL_CRITICAL_SECTION) hsem; + + EngAcquireSemaphore(hsem); + EngReleaseSemaphore(hsem); + + RTEST (lpcrit->LockCount != 0); + RTEST (lpcrit->RecursionCount == 0); + RTEST (lpcrit->OwningThread == 0); + RTEST (lpcrit->LockSemaphore == 0); + RTEST (lpcrit->SpinCount == 0); + + ASSERT(lpcrit->DebugInfo != NULL); + RTEST (lpcrit->DebugInfo->Type == 0); + RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex == 0); + RTEST (lpcrit->DebugInfo->EntryCount == 0); + RTEST (lpcrit->DebugInfo->ContentionCount == 0); + + EngDeleteSemaphore(hsem); + + /* try with deleted Semaphore */ + EngReleaseSemaphore(hsem); + RTEST (lpcrit->LockCount > 0); + RTEST (lpcrit->RecursionCount != 0); + RTEST (lpcrit->OwningThread == 0); + RTEST (lpcrit->LockSemaphore == 0); + RTEST (lpcrit->SpinCount == 0); + + ASSERT(lpcrit->DebugInfo != NULL); + RTEST (lpcrit->DebugInfo->Type != 0); + RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0); + RTEST (lpcrit->DebugInfo->EntryCount != 0); + RTEST (lpcrit->DebugInfo->ContentionCount != 0); + + /* NULL pointer test */ + // Note NULL pointer test crash in Vista */ + // EngReleaseSemaphore(NULL); + + /* negtive pointer test */ + // Note negtive pointer test crash in Vista */ + // EngReleaseSemaphore((HSEMAPHORE)-1); + + + return APISTATUS_NORMAL; +} +
Propchange: trunk/rostests/apitests/gdi32api/tests/EngReleaseSemaphore.c ------------------------------------------------------------------------------ svn:eol-style = native