Andrew Nguyen : ntdll/tests: Make function pointer checks consistent and report skips.

Alexandre Julliard julliard at winehq.org
Thu Jan 14 11:33:36 CST 2010


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

Author: Andrew Nguyen <arethusa26 at gmail.com>
Date:   Wed Jan 13 06:44:44 2010 -0600

ntdll/tests: Make function pointer checks consistent and report skips.

---

 dlls/ntdll/tests/rtl.c |  118 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 88 insertions(+), 30 deletions(-)

diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 7beef6d..37479a7 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -112,7 +112,10 @@ static void test_RtlCompareMemory(void)
   SIZE_T size;
 
   if (!pRtlCompareMemory)
+  {
+    win_skip("RtlCompareMemory is not available\n");
     return;
+  }
 
   strcpy(dest, src);
 
@@ -127,6 +130,12 @@ static void test_RtlCompareMemoryUlong(void)
     ULONG a[10];
     ULONG result;
 
+    if (!pRtlCompareMemoryUlong)
+    {
+        win_skip("RtlCompareMemoryUlong is not available\n");
+        return;
+    }
+
     a[0]= 0x0123;
     a[1]= 0x4567;
     a[2]= 0x89ab;
@@ -173,7 +182,10 @@ static void test_RtlCompareMemoryUlong(void)
 static void test_RtlMoveMemory(void)
 {
   if (!pRtlMoveMemory)
+  {
+    win_skip("RtlMoveMemory is not available\n");
     return;
+  }
 
   /* Length should be in bytes and not rounded. Use strcmp to ensure we
    * didn't write past the end (it checks for the final NUL left by memset)
@@ -201,7 +213,10 @@ static void test_RtlMoveMemory(void)
 static void test_RtlFillMemory(void)
 {
   if (!pRtlFillMemory)
+  {
+    win_skip("RtlFillMemory is not available\n");
     return;
+  }
 
   /* Length should be in bytes and not rounded. Use strcmp to ensure we
    * didn't write past the end (the remainder of the string should match)
@@ -224,7 +239,10 @@ static void test_RtlFillMemoryUlong(void)
 {
   ULONG val = ('x' << 24) | ('x' << 16) | ('x' << 8) | 'x';
   if (!pRtlFillMemoryUlong)
+  {
+    win_skip("RtlFillMemoryUlong is not available\n");
     return;
+  }
 
   /* Length should be in bytes and not rounded. Use strcmp to ensure we
    * didn't write past the end (the remainder of the string should match)
@@ -247,7 +265,10 @@ static void test_RtlFillMemoryUlong(void)
 static void test_RtlZeroMemory(void)
 {
   if (!pRtlZeroMemory)
+  {
+    win_skip("RtlZeroMemory is not available\n");
     return;
+  }
 
   /* Length should be in bytes and not rounded. */
   ZERO(0); MCMP("This is a test!");
@@ -266,6 +287,12 @@ static void test_RtlUlonglongByteSwap(void)
 {
     ULONGLONG result;
 
+    if ( !pRtlUlonglongByteSwap )
+    {
+        win_skip("RtlUlonglongByteSwap is not available\n");
+        return;
+    }
+
     if ( pRtlUlonglongByteSwap( 0 ) != 0 )
     {
         win_skip("Broken RtlUlonglongByteSwap in win2k\n");
@@ -287,6 +314,12 @@ static void test_RtlUniform(void)
     ULONG expected;
     ULONG result;
 
+    if (!pRtlUniform)
+    {
+        win_skip("RtlUniform is not available\n");
+        return;
+    }
+
 /*
  * According to the documentation RtlUniform is using D.H. Lehmer's 1948
  * algorithm. This algorithm is:
@@ -612,6 +645,12 @@ static void test_RtlRandom(void)
     ULONG result;
     ULONG result_expected;
 
+    if (!pRtlRandom)
+    {
+        win_skip("RtlRandom is not available\n");
+        return;
+    }
+
 /*
  * Unlike RtlUniform, RtlRandom is not documented. We guess that for
  * RtlRandom D.H. Lehmer's 1948 algorithm is used like stated in
@@ -820,6 +859,12 @@ static void test_RtlAreAllAccessesGranted(void)
     unsigned int test_num;
     BOOLEAN result;
 
+    if (!pRtlAreAllAccessesGranted)
+    {
+        win_skip("RtlAreAllAccessesGranted is not available\n");
+        return;
+    }
+
     for (test_num = 0; test_num < NB_ALL_ACCESSES; test_num++) {
 	result = pRtlAreAllAccessesGranted(all_accesses[test_num].GrantedAccess,
 					   all_accesses[test_num].DesiredAccess);
@@ -857,6 +902,12 @@ static void test_RtlAreAnyAccessesGranted(void)
     unsigned int test_num;
     BOOLEAN result;
 
+    if (!pRtlAreAnyAccessesGranted)
+    {
+        win_skip("RtlAreAnyAccessesGranted is not available\n");
+        return;
+    }
+
     for (test_num = 0; test_num < NB_ANY_ACCESSES; test_num++) {
 	result = pRtlAreAnyAccessesGranted(any_accesses[test_num].GrantedAccess,
 					   any_accesses[test_num].DesiredAccess);
@@ -873,7 +924,10 @@ static void test_RtlComputeCrc32(void)
   DWORD crc = 0;
 
   if (!pRtlComputeCrc32)
+  {
+    win_skip("RtlComputeCrc32 is not available\n");
     return;
+  }
 
   crc = pRtlComputeCrc32(crc, (const BYTE *)src, LEN);
   ok(crc == 0x40861dc2,"Expected 0x40861dc2, got %8x\n", crc);
@@ -900,6 +954,12 @@ static void test_HandleTables(void)
     MY_HANDLE * MyHandle;
     RTL_HANDLE_TABLE HandleTable;
 
+    if (!pRtlInitializeHandleTable)
+    {
+        win_skip("RtlInitializeHandleTable is not available\n");
+        return;
+    }
+
     pRtlInitializeHandleTable(0x3FFF, sizeof(MY_HANDLE), &HandleTable);
     MyHandle = (MY_HANDLE *)pRtlAllocateHandle(&HandleTable, &Index);
     ok(MyHandle != NULL, "RtlAllocateHandle failed\n");
@@ -919,6 +979,12 @@ static void test_RtlAllocateAndInitializeSid(void)
     SID_IDENTIFIER_AUTHORITY sia = {{ 1, 2, 3, 4, 5, 6 }};
     PSID psid;
 
+    if (!pRtlAllocateAndInitializeSid)
+    {
+        win_skip("RtlAllocateAndInitializeSid is not available\n");
+        return;
+    }
+
     ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
     ok(!ret, "RtlAllocateAndInitializeSid error %08x\n", ret);
     ret = pRtlFreeSid(psid);
@@ -935,6 +1001,13 @@ static void test_RtlAllocateAndInitializeSid(void)
 static void test_RtlDeleteTimer(void)
 {
     NTSTATUS ret;
+
+    if (!pRtlDeleteTimer)
+    {
+        win_skip("RtlDeleteTimer is not available\n");
+        return;
+    }
+
     ret = pRtlDeleteTimer(NULL, NULL, NULL);
     ok(ret == STATUS_INVALID_PARAMETER_1 ||
        ret == STATUS_INVALID_PARAMETER, /* W2K */
@@ -945,34 +1018,19 @@ START_TEST(rtl)
 {
     InitFunctionPtrs();
 
-    if (pRtlCompareMemory)
-        test_RtlCompareMemory();
-    if (pRtlCompareMemoryUlong)
-        test_RtlCompareMemoryUlong();
-    if (pRtlMoveMemory)
-        test_RtlMoveMemory();
-    if (pRtlFillMemory)
-        test_RtlFillMemory();
-    if (pRtlFillMemoryUlong)
-        test_RtlFillMemoryUlong();
-    if (pRtlZeroMemory)
-        test_RtlZeroMemory();
-    if (pRtlUlonglongByteSwap)
-        test_RtlUlonglongByteSwap();
-    if (pRtlUniform)
-        test_RtlUniform();
-    if (pRtlRandom)
-        test_RtlRandom();
-    if (pRtlAreAllAccessesGranted)
-        test_RtlAreAllAccessesGranted();
-    if (pRtlAreAnyAccessesGranted)
-        test_RtlAreAnyAccessesGranted();
-    if (pRtlComputeCrc32)
-        test_RtlComputeCrc32();
-    if (pRtlInitializeHandleTable)
-        test_HandleTables();
-    if (pRtlAllocateAndInitializeSid)
-        test_RtlAllocateAndInitializeSid();
-    if (pRtlDeleteTimer)
-        test_RtlDeleteTimer();
+    test_RtlCompareMemory();
+    test_RtlCompareMemoryUlong();
+    test_RtlMoveMemory();
+    test_RtlFillMemory();
+    test_RtlFillMemoryUlong();
+    test_RtlZeroMemory();
+    test_RtlUlonglongByteSwap();
+    test_RtlUniform();
+    test_RtlRandom();
+    test_RtlAreAllAccessesGranted();
+    test_RtlAreAnyAccessesGranted();
+    test_RtlComputeCrc32();
+    test_HandleTables();
+    test_RtlAllocateAndInitializeSid();
+    test_RtlDeleteTimer();
 }




More information about the wine-cvs mailing list