Commit e2a8da9e authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

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.
parent 17d798ea
...@@ -53,7 +53,7 @@ static void testQuery(void) ...@@ -53,7 +53,7 @@ static void testQuery(void)
{ {
BOOL (WINAPI *pQuery)(BYTE, SnmpVarBindList *, AsnInteger32 *, BOOL (WINAPI *pQuery)(BYTE, SnmpVarBindList *, AsnInteger32 *,
AsnInteger32 *); AsnInteger32 *);
BOOL ret, moreData; BOOL ret, moreData, noChange;
SnmpVarBindList list; SnmpVarBindList list;
AsnInteger32 error, index; AsnInteger32 error, index;
UINT bogus[] = { 1,2,3,4 }; UINT bogus[] = { 1,2,3,4 };
...@@ -157,6 +157,7 @@ static void testQuery(void) ...@@ -157,6 +157,7 @@ static void testQuery(void)
SnmpUtilOidCpy(&vars2[2].name, &vars[2].name); SnmpUtilOidCpy(&vars2[2].name, &vars[2].name);
list.list = vars2; list.list = vars2;
moreData = TRUE; moreData = TRUE;
noChange = FALSE;
entry = 0; entry = 0;
do { do {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -180,6 +181,15 @@ static void testQuery(void) ...@@ -180,6 +181,15 @@ static void testQuery(void)
else if (SnmpUtilOidNCmp(&vars2[2].name, &vars[2].name, else if (SnmpUtilOidNCmp(&vars2[2].name, &vars[2].name,
vars[2].name.idLength)) vars[2].name.idLength))
moreData = FALSE; 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) if (moreData)
{ {
UINT lastID; UINT lastID;
...@@ -224,7 +234,9 @@ static void testQuery(void) ...@@ -224,7 +234,9 @@ static void testQuery(void)
"expected a value of 0, 1, or 2, got %u\n", "expected a value of 0, 1, or 2, got %u\n",
vars2[2].value.asnValue.unsigned32); 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[0]);
SnmpUtilVarBindFree(&vars2[1]); SnmpUtilVarBindFree(&vars2[1]);
SnmpUtilVarBindFree(&vars2[2]); SnmpUtilVarBindFree(&vars2[2]);
...@@ -240,6 +252,7 @@ static void testQuery(void) ...@@ -240,6 +252,7 @@ static void testQuery(void)
list.len = 1; list.len = 1;
list.list = vars2; list.list = vars2;
moreData = TRUE; moreData = TRUE;
noChange = FALSE;
ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index); ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError()); ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOERROR, ok(error == SNMP_ERRORSTATUS_NOERROR,
...@@ -272,6 +285,13 @@ static void testQuery(void) ...@@ -272,6 +285,13 @@ static void testQuery(void)
else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name, else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name,
vars[0].name.idLength)) vars[0].name.idLength))
moreData = FALSE; 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) if (moreData)
{ {
/* Make sure the size of the OID is right. /* Make sure the size of the OID is right.
...@@ -304,7 +324,9 @@ static void testQuery(void) ...@@ -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]); SnmpUtilVarBindFree(&vars2[0]);
/* Check the type and OIDs of the IP route table */ /* Check the type and OIDs of the IP route table */
...@@ -315,6 +337,7 @@ static void testQuery(void) ...@@ -315,6 +337,7 @@ static void testQuery(void)
list.len = 1; list.len = 1;
list.list = vars2; list.list = vars2;
moreData = TRUE; moreData = TRUE;
noChange = FALSE;
do { do {
ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index); ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError()); ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
...@@ -328,6 +351,13 @@ static void testQuery(void) ...@@ -328,6 +351,13 @@ static void testQuery(void)
else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name, else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name,
vars[0].name.idLength)) vars[0].name.idLength))
moreData = FALSE; 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) if (moreData)
{ {
/* Make sure the size of the OID is right. /* Make sure the size of the OID is right.
...@@ -360,7 +390,9 @@ static void testQuery(void) ...@@ -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]); SnmpUtilVarBindFree(&vars2[0]);
/* Check the type and OIDs of the UDP table */ /* Check the type and OIDs of the UDP table */
...@@ -371,6 +403,7 @@ static void testQuery(void) ...@@ -371,6 +403,7 @@ static void testQuery(void)
list.len = 1; list.len = 1;
list.list = vars2; list.list = vars2;
moreData = TRUE; moreData = TRUE;
noChange = FALSE;
do { do {
ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index); ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError()); ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
...@@ -392,6 +425,13 @@ static void testQuery(void) ...@@ -392,6 +425,13 @@ static void testQuery(void)
else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name, else if (SnmpUtilOidNCmp(&vars2[0].name, &vars[0].name,
vars[0].name.idLength)) vars[0].name.idLength))
moreData = FALSE; 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) if (moreData)
{ {
/* Make sure the size of the OID is right. */ /* Make sure the size of the OID is right. */
...@@ -422,7 +462,9 @@ static void testQuery(void) ...@@ -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]); SnmpUtilVarBindFree(&vars2[0]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment