[PATCH] rpcrt4/tests: Always run tests that don't require special permissions.

Nikolay Sivov nsivov at codeweavers.com
Mon Sep 13 02:01:42 CDT 2021


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/rpcrt4/tests/rpc.c | 102 +++++++++++++++++++++++-----------------
 1 file changed, 58 insertions(+), 44 deletions(-)

diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c
index 8ae63a140e7..11c3bf51d79 100644
--- a/dlls/rpcrt4/tests/rpc.c
+++ b/dlls/rpcrt4/tests/rpc.c
@@ -78,35 +78,49 @@ static BOOL Uuid_Comparison_Grid[11][11] = {
   { TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE  }
 };
 
-static void UuidConversionAndComparison(void) {
+static void test_UuidEqual(void)
+{
+    UUID Uuid1, Uuid2, *PUuid1, *PUuid2;
+    RPC_STATUS status;
+    int i1, i2;
+
+    /* Uuid Equality */
+    for (i1 = 0; i1 < 11; i1++)
+    {
+        for (i2 = 0; i2 < 11; i2++)
+        {
+            if (i1 < 10)
+            {
+                Uuid1 = Uuid_Table[i1];
+                PUuid1 = &Uuid1;
+            }
+            else
+                PUuid1 = NULL;
+
+            if (i2 < 10)
+            {
+                Uuid2 = Uuid_Table[i2];
+                PUuid2 = &Uuid2;
+            }
+            else
+                PUuid2 = NULL;
+            ok(UuidEqual(PUuid1, PUuid2, &status) == Uuid_Comparison_Grid[i1][i2], "UUID Equality\n" );
+        }
+    }
+}
+
+static void test_UuidFromString(void)
+{
     CHAR strx[100], x;
     LPSTR str = strx;
     WCHAR wstrx[100], wx;
     LPWSTR wstr = wstrx;
 
-    UUID Uuid1, Uuid2, *PUuid1, *PUuid2;
+    UUID Uuid1, Uuid2;
     RPC_STATUS rslt;
 
     int i1,i2;
 
-    /* Uuid Equality */
-    for (i1 = 0; i1 < 11; i1++)
-        for (i2 = 0; i2 < 11; i2++) {
-	    if (i1 < 10) {
-	        Uuid1 = Uuid_Table[i1]; 
-		PUuid1 = &Uuid1;
-            } else {
-	        PUuid1 = NULL;
-	    }        
-	    if (i2 < 10) {
-	        Uuid2 = Uuid_Table[i2];
-		PUuid2 = &Uuid2;
-            } else {
-	        PUuid2 = NULL;
-	    }
-	    ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality\n" );
-        }
-
     /* Uuid to String to Uuid (char) */
     for (i1 = 0; i1 < 10; i1++) {
         Uuid1 = Uuid_Table[i1];
@@ -141,7 +155,7 @@ static void UuidConversionAndComparison(void) {
     }
 }
 
-static void TestDceErrorInqText (void)
+static void test_DceErrorInqTextA(void)
 {
     char bufferInvalid [1024];
     char buffer [1024]; /* The required size is not documented but would
@@ -649,17 +663,10 @@ static void test_RpcStringBindingParseA(void)
     ok(options == NULL, "options was %p instead of NULL\n", options);
 }
 
-static void test_RpcExceptionFilter(const char *func_name)
+static void test_RpcExceptionFilter(void)
 {
+    int retval, retval2;
     ULONG exception;
-    int retval;
-    int (WINAPI *pRpcExceptionFilter)(ULONG) = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), func_name);
-
-    if (!pRpcExceptionFilter)
-    {
-        win_skip("%s not exported\n", func_name);
-        return;
-    }
 
     for (exception = 0; exception < STATUS_REG_NAT_CONSUMPTION; exception++)
     {
@@ -668,7 +675,8 @@ static void test_RpcExceptionFilter(const char *func_name)
         if (exception == 0x40000005) exception = 0x80000000;
         if (exception == 0x80000005) exception = 0xc0000000;
 
-        retval = pRpcExceptionFilter(exception);
+        retval = RpcExceptionFilter(exception);
+        retval2 = I_RpcExceptionFilter(exception);
         switch (exception)
         {
         case STATUS_DATATYPE_MISALIGNMENT:
@@ -679,17 +687,22 @@ static void test_RpcExceptionFilter(const char *func_name)
         case STATUS_INSTRUCTION_MISALIGNMENT:
         case STATUS_STACK_OVERFLOW:
         case STATUS_POSSIBLE_DEADLOCK:
-            ok(retval == EXCEPTION_CONTINUE_SEARCH, "%s(0x%x) should have returned %d instead of %d\n",
-               func_name, exception, EXCEPTION_CONTINUE_SEARCH, retval);
+            ok(retval == EXCEPTION_CONTINUE_SEARCH, "RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+                    exception, EXCEPTION_CONTINUE_SEARCH, retval);
+            ok(retval2 == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+                    exception, EXCEPTION_CONTINUE_SEARCH, retval);
             break;
         case STATUS_GUARD_PAGE_VIOLATION:
         case STATUS_IN_PAGE_ERROR:
         case STATUS_HANDLE_NOT_CLOSABLE:
-            trace("%s(0x%x) returned %d\n", func_name, exception, retval);
+            ok(!retval, "Unexpected return value %d.\n", retval);
+            ok(!retval2, "Unexpected return value %d.\n", retval2);
             break;
         default:
-            ok(retval == EXCEPTION_EXECUTE_HANDLER, "%s(0x%x) should have returned %d instead of %d\n",
-               func_name, exception, EXCEPTION_EXECUTE_HANDLER, retval);
+            ok(retval == EXCEPTION_EXECUTE_HANDLER, "RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+                   exception, EXCEPTION_EXECUTE_HANDLER, retval);
+            ok(retval2 == EXCEPTION_EXECUTE_HANDLER, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+                   exception, EXCEPTION_EXECUTE_HANDLER, retval);
         }
     }
 }
@@ -1235,22 +1248,23 @@ START_TEST( rpc )
     static unsigned char np_address[] = ".";
     BOOL firewall_enabled = is_firewall_enabled();
 
+    test_UuidEqual();
+    test_UuidFromString();
+    test_UuidCreate();
+    test_UuidCreateSequential();
+    test_DceErrorInqTextA();
+    test_I_RpcMapWin32Status();
+    test_RpcStringBindingParseA();
+    test_RpcExceptionFilter();
+
     if (firewall_enabled && !is_process_elevated())
     {
         skip("no privileges, skipping tests to avoid firewall dialog\n");
         return;
     }
 
-    UuidConversionAndComparison();
-    TestDceErrorInqText();
     test_towers();
-    test_I_RpcMapWin32Status();
-    test_RpcStringBindingParseA();
-    test_RpcExceptionFilter("I_RpcExceptionFilter");
-    test_RpcExceptionFilter("RpcExceptionFilter");
     test_RpcStringBindingFromBinding();
-    test_UuidCreate();
-    test_UuidCreateSequential();
     test_RpcBindingFree();
     test_RpcIfInqId();
     test_RpcServerInqDefaultPrincName();
-- 
2.33.0




More information about the wine-devel mailing list