[PATCH 1/3] inetmib1/tests: Limit the time spent in the loops.
Bernhard Übelacker
bernhardu at mailbox.org
Thu Dec 16 04:29:07 CST 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52224
Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
---
dlls/inetmib1/tests/main.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/dlls/inetmib1/tests/main.c b/dlls/inetmib1/tests/main.c
index 32785fcc3fe..a4a1dbe7cdb 100644
--- a/dlls/inetmib1/tests/main.c
+++ b/dlls/inetmib1/tests/main.c
@@ -95,6 +95,8 @@ static void testQuery(void)
UINT mib2UdpTable[] = { 1,3,6,1,2,1,7,5,1,1 };
SnmpVarBind vars[3], vars2[3], vars3[3];
UINT entry;
+ ULONGLONG start_time;
+ int timeout_reached;
if (!pSnmpExtensionQuery)
{
@@ -189,6 +191,7 @@ if (0) /* crashes on native */
moreData = TRUE;
noChange = FALSE;
entry = 0;
+ start_time = GetTickCount64();
do {
SetLastError(0xdeadbeef);
error = 0xdeadbeef;
@@ -259,7 +262,9 @@ if (0) /* crashes on native */
}
else if (noChange)
skip("no change in OID, no MIB2 IF table implementation\n");
- } while (moreData && !noChange);
+ timeout_reached = GetTickCount64() > start_time + 5000;
+ } while (moreData && !noChange && !timeout_reached);
+ ok(!timeout_reached, "loop finished not in time.\n");
SnmpUtilVarBindFree(&vars2[0]);
SnmpUtilVarBindFree(&vars2[1]);
SnmpUtilVarBindFree(&vars2[2]);
@@ -296,6 +301,7 @@ if (0) /* crashes on native */
list.len = 1;
list.list = vars2;
moreData = TRUE;
+ start_time = GetTickCount64();
do {
ret = pSnmpExtensionQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
ok(ret, "SnmpExtensionQuery failed: %d, %d\n", error, index);
@@ -350,7 +356,9 @@ if (0) /* crashes on native */
}
else if (noChange)
skip("no change in OID, no MIB2 IP address table implementation\n");
- } while (moreData && !noChange);
+ timeout_reached = GetTickCount64() > start_time + 5000;
+ } while (moreData && !noChange && !timeout_reached);
+ ok(!timeout_reached, "loop finished not in time.\n");
SnmpUtilVarBindFree(&vars2[0]);
/* Check the type and OIDs of the IP route table */
@@ -362,6 +370,7 @@ if (0) /* crashes on native */
list.list = vars2;
moreData = TRUE;
noChange = FALSE;
+ start_time = GetTickCount64();
do {
ret = pSnmpExtensionQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
ok(ret, "SnmpExtensionQuery failed: %d, %d\n", error, index);
@@ -416,7 +425,9 @@ if (0) /* crashes on native */
}
else if (noChange)
skip("no change in OID, no MIB2 IP route table implementation\n");
- } while (moreData && !noChange);
+ timeout_reached = GetTickCount64() > start_time + 5000;
+ } while (moreData && !noChange && !timeout_reached);
+ ok(!timeout_reached, "loop finished not in time.\n");
SnmpUtilVarBindFree(&vars2[0]);
/* Check the type and OIDs of the UDP table */
@@ -428,6 +439,7 @@ if (0) /* crashes on native */
list.list = vars2;
moreData = TRUE;
noChange = FALSE;
+ start_time = GetTickCount64();
do {
ret = pSnmpExtensionQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
ok(ret, "SnmpExtensionQuery failed: %d, %d\n", error, index);
@@ -488,7 +500,9 @@ if (0) /* crashes on native */
}
else if (noChange)
skip("no change in OID, no MIB2 UDP table implementation\n");
- } while (moreData && !noChange);
+ timeout_reached = GetTickCount64() > start_time + 5000;
+ } while (moreData && !noChange && !timeout_reached);
+ ok(!timeout_reached, "loop finished not in time.\n");
SnmpUtilVarBindFree(&vars2[0]);
}
--
2.34.1
More information about the wine-devel
mailing list