Juan Lang : inetmib1: Skip tests if a portion of inetmib1 isn't implemented .

Alexandre Julliard julliard at winehq.org
Tue Sep 30 11:15:57 CDT 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Sun Sep 28 09:05:20 2008 -0700

inetmib1: Skip tests if a portion of inetmib1 isn't implemented.

This fixes a hang (and sometimes a system hang) on MacOSX when running
the inetmib1 tests.  Spotted by Owen Rudge.

---

 dlls/inetmib1/tests/main.c |   52 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/dlls/inetmib1/tests/main.c b/dlls/inetmib1/tests/main.c
index 6eead89..d4d6f16 100644
--- a/dlls/inetmib1/tests/main.c
+++ b/dlls/inetmib1/tests/main.c
@@ -53,7 +53,7 @@ static void testQuery(void)
 {
     BOOL (WINAPI *pQuery)(BYTE, SnmpVarBindList *, AsnInteger32 *,
         AsnInteger32 *);
-    BOOL ret, moreData;
+    BOOL ret, moreData, noChange;
     SnmpVarBindList list;
     AsnInteger32 error, index;
     UINT bogus[] = { 1,2,3,4 };
@@ -157,6 +157,7 @@ static void testQuery(void)
     SnmpUtilOidCpy(&vars2[2].name, &vars[2].name);
     list.list = vars2;
     moreData = TRUE;
+    noChange = FALSE;
     entry = 0;
     do {
         SetLastError(0xdeadbeef);
@@ -180,6 +181,15 @@ static void testQuery(void)
         else if (SnmpUtilOidNCmp(&vars2[2].name, &vars[2].name,
             vars[2].name.idLength))
             moreData = FALSE;
+        else if (!SnmpUtilOidCmp(&vars[0].name, &vars2[0].name) ||
+         !SnmpUtilOidCmp(&vars[0].name, &vars2[0].name) ||
+         !SnmpUtilOidCmp(&vars[0].name, &vars2[0].name))
+        {
+            /* If the OID isn't modified, the function isn't implemented on this
+             * platform, skip the remaining tests.
+             */
+            noChange = TRUE;
+        }
         if (moreData)
         {
             UINT lastID;
@@ -224,7 +234,9 @@ static void testQuery(void)
                 "expected a value of 0, 1, or 2, got %u\n",
                 vars2[2].value.asnValue.unsigned32);
         }
-    } while (moreData);
+        else if (noChange)
+            skip("no change in OID, no MIB2 IF table implementation\n");
+    } while (moreData && !noChange);
     SnmpUtilVarBindFree(&vars2[0]);
     SnmpUtilVarBindFree(&vars2[1]);
     SnmpUtilVarBindFree(&vars2[2]);
@@ -240,6 +252,7 @@ static void testQuery(void)
     list.len = 1;
     list.list = vars2;
     moreData = TRUE;
+    noChange = FALSE;
     ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
     ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
     ok(error == SNMP_ERRORSTATUS_NOERROR,
@@ -272,6 +285,13 @@ static void testQuery(void)
         else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name,
             vars[0].name.idLength))
             moreData = FALSE;
+        else if (!SnmpUtilOidCmp(&vars2[0].name, &vars[0].name))
+        {
+            /* If the OID isn't modified, the function isn't implemented on this
+             * platform, skip the remaining tests.
+             */
+            noChange = TRUE;
+        }
         if (moreData)
         {
             /* Make sure the size of the OID is right.
@@ -304,7 +324,9 @@ static void testQuery(void)
                 }
             }
         }
-    } while (moreData);
+        else if (noChange)
+            skip("no change in OID, no MIB2 IP address table implementation\n");
+    } while (moreData && !noChange);
     SnmpUtilVarBindFree(&vars2[0]);
 
     /* Check the type and OIDs of the IP route table */
@@ -315,6 +337,7 @@ static void testQuery(void)
     list.len = 1;
     list.list = vars2;
     moreData = TRUE;
+    noChange = FALSE;
     do {
         ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
         ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
@@ -328,6 +351,13 @@ static void testQuery(void)
         else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name,
             vars[0].name.idLength))
             moreData = FALSE;
+        else if (!SnmpUtilOidCmp(&vars2[0].name, &vars[0].name))
+        {
+            /* If the OID isn't modified, the function isn't implemented on this
+             * platform, skip the remaining tests.
+             */
+            noChange = TRUE;
+        }
         if (moreData)
         {
             /* Make sure the size of the OID is right.
@@ -360,7 +390,9 @@ static void testQuery(void)
                 }
             }
         }
-    } while (moreData);
+        else if (noChange)
+            skip("no change in OID, no MIB2 IP route table implementation\n");
+    } while (moreData && !noChange);
     SnmpUtilVarBindFree(&vars2[0]);
 
     /* Check the type and OIDs of the UDP table */
@@ -371,6 +403,7 @@ static void testQuery(void)
     list.len = 1;
     list.list = vars2;
     moreData = TRUE;
+    noChange = FALSE;
     do {
         ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
         ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
@@ -392,6 +425,13 @@ static void testQuery(void)
         else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name,
             vars[0].name.idLength))
             moreData = FALSE;
+        else if (!SnmpUtilOidCmp(&vars2[0].name, &vars[0].name))
+        {
+            /* If the OID isn't modified, the function isn't implemented on this
+             * platform, skip the remaining tests.
+             */
+            noChange = TRUE;
+        }
         if (moreData)
         {
             /* Make sure the size of the OID is right. */
@@ -422,7 +462,9 @@ static void testQuery(void)
                 }
             }
         }
-    } while (moreData);
+        else if (noChange)
+            skip("no change in OID, no MIB2 UDP table implementation\n");
+    } while (moreData && !noChange);
     SnmpUtilVarBindFree(&vars2[0]);
 }
 




More information about the wine-cvs mailing list