As shown by the testbot, doubling is not always sufficient.
-- v3: iphlpapi/tests: Call GetExtendedTcp/UdpTable() in a loop.
From: Hans Leidekker hans@codeweavers.com
As shown by the testbot, doubling is not always sufficient. --- dlls/iphlpapi/tests/iphlpapi.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 090cd2c9ff9..bd566980500 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1769,6 +1769,13 @@ static void test_GetAdaptersAddresses(void) osize = size; ptr = malloc(osize); ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize); + while (ret == ERROR_BUFFER_OVERFLOW) + { + size = osize * 2; + osize = size; + ptr = realloc(ptr, osize); + ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize); + } ok(!ret, "expected ERROR_SUCCESS got %lu\n", ret); ok(osize == size, "expected %ld, got %ld\n", size, osize);
From: Hans Leidekker hans@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54588 --- dlls/iphlpapi/tests/iphlpapi.c | 103 +++++++++++++++------------------ 1 file changed, 47 insertions(+), 56 deletions(-)
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index bd566980500..cd192003345 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1866,9 +1866,27 @@ static void test_GetAdaptersAddresses(void) free(ptr); }
+static DWORD get_extended_tcp_table( ULONG family, TCP_TABLE_CLASS class, void **table ) +{ + DWORD ret, size = 0; + + *table = NULL; + ret = pGetExtendedTcpTable( NULL, &size, TRUE, family, class, 0 ); + if (ret != ERROR_INSUFFICIENT_BUFFER) return ret; + + *table = malloc( size ); + ret = pGetExtendedTcpTable( *table, &size, TRUE, family, class, 0 ); + while (ret == ERROR_INSUFFICIENT_BUFFER) + { + *table = realloc( *table, size ); + ret = pGetExtendedTcpTable( *table, &size, TRUE, family, class, 0 ); + } + return ret; +} + static void test_GetExtendedTcpTable(void) { - DWORD ret, size; + DWORD ret; MIB_TCPTABLE *table; MIB_TCPTABLE_OWNER_PID *table_pid; MIB_TCPTABLE_OWNER_MODULE *table_module; @@ -1881,57 +1899,27 @@ static void test_GetExtendedTcpTable(void) ret = pGetExtendedTcpTable( NULL, NULL, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 ); ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
- size = 0; - ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table = malloc( size ); - ret = pGetExtendedTcpTable( table, &size, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 ); + ret = get_extended_tcp_table( AF_INET, TCP_TABLE_BASIC_ALL, (void **)&table ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table );
- size = 0; - ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_BASIC_LISTENER, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table = malloc( size ); - ret = pGetExtendedTcpTable( table, &size, TRUE, AF_INET, TCP_TABLE_BASIC_LISTENER, 0 ); + ret = get_extended_tcp_table( AF_INET, TCP_TABLE_BASIC_LISTENER, (void **)&table ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table );
- size = 0; - ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table_pid = malloc( size ); - ret = pGetExtendedTcpTable( table_pid, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0 ); + ret = get_extended_tcp_table( AF_INET, TCP_TABLE_OWNER_PID_ALL, (void **)&table_pid ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table_pid );
- size = 0; - ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_LISTENER, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table_pid = malloc( size ); - ret = pGetExtendedTcpTable( table_pid, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_LISTENER, 0 ); + ret = get_extended_tcp_table( AF_INET, TCP_TABLE_OWNER_PID_LISTENER, (void **)&table_pid ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table_pid );
- size = 0; - ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_ALL, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table_module = malloc( size ); - ret = pGetExtendedTcpTable( table_module, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_ALL, 0 ); + ret = get_extended_tcp_table( AF_INET, TCP_TABLE_OWNER_MODULE_ALL, (void **)&table_module ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table_module );
- size = 0; - ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_LISTENER, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table_module = malloc( size ); - ret = pGetExtendedTcpTable( table_module, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_LISTENER, 0 ); + ret = get_extended_tcp_table( AF_INET, TCP_TABLE_OWNER_MODULE_LISTENER, (void **)&table_module ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table_module ); } @@ -1985,9 +1973,27 @@ static void test_AllocateAndGetTcpExTableFromStack(void) ok( ret == ERROR_NOT_SUPPORTED, "got %lu\n", ret ); }
+static DWORD get_extended_udp_table( ULONG family, UDP_TABLE_CLASS class, void **table ) +{ + DWORD ret, size = 0; + + *table = NULL; + ret = pGetExtendedUdpTable( NULL, &size, TRUE, family, class, 0 ); + if (ret != ERROR_INSUFFICIENT_BUFFER) return ret; + + *table = malloc( size ); + ret = pGetExtendedUdpTable( *table, &size, TRUE, family, class, 0 ); + while (ret == ERROR_INSUFFICIENT_BUFFER) + { + *table = realloc( *table, size ); + ret = pGetExtendedUdpTable( *table, &size, TRUE, family, class, 0 ); + } + return ret; +} + static void test_GetExtendedUdpTable(void) { - DWORD ret, size; + DWORD ret; MIB_UDPTABLE *table; MIB_UDPTABLE_OWNER_PID *table_pid; MIB_UDPTABLE_OWNER_MODULE *table_module; @@ -2000,30 +2006,15 @@ static void test_GetExtendedUdpTable(void) ret = pGetExtendedUdpTable( NULL, NULL, TRUE, AF_INET, UDP_TABLE_BASIC, 0 ); ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
- size = 0; - ret = pGetExtendedUdpTable( NULL, &size, TRUE, AF_INET, UDP_TABLE_BASIC, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table = malloc( size ); - ret = pGetExtendedUdpTable( table, &size, TRUE, AF_INET, UDP_TABLE_BASIC, 0 ); + ret = get_extended_udp_table( AF_INET, UDP_TABLE_BASIC, (void **)&table ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table );
- size = 0; - ret = pGetExtendedUdpTable( NULL, &size, TRUE, AF_INET, UDP_TABLE_OWNER_PID, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table_pid = malloc( size ); - ret = pGetExtendedUdpTable( table_pid, &size, TRUE, AF_INET, UDP_TABLE_OWNER_PID, 0 ); + ret = get_extended_udp_table( AF_INET, UDP_TABLE_OWNER_PID, (void **)&table_pid ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table_pid );
- size = 0; - ret = pGetExtendedUdpTable( NULL, &size, TRUE, AF_INET, UDP_TABLE_OWNER_MODULE, 0 ); - ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", ret ); - - table_module = malloc( size ); - ret = pGetExtendedUdpTable( table_module, &size, TRUE, AF_INET, UDP_TABLE_OWNER_MODULE, 0 ); + ret = get_extended_udp_table( AF_INET, UDP_TABLE_OWNER_MODULE, (void **)&table_module ); ok( ret == ERROR_SUCCESS, "got %lu\n", ret ); free( table_module ); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
2 TestBot errors prevented a full analysis of your patch. If the test caused the operating system (e.g. Windows) to crash or reboot you will probably have to modify it to avoid that. Other issues should be reported to the TestBot administrators.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=151976
Your paranoid android.
=== build (build log) ===
WineRunBuild.pl:error: Could not copy the patch to the VM: network read timed out (sendfile/connect:AgentVersion.h:0/9) WineRunBuild.pl:error: BotError: The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died)
=== debian11 (build log) ===
error: patch failed: dlls/iphlpapi/tests/iphlpapi.c:1769 error: patch failed: dlls/iphlpapi/tests/iphlpapi.c:1866 Task: Patch failed to apply
=== debian11b (build log) ===
WineRunWineTest.pl:error: Could not send 'patch.diff' to the VM: network read timed out (sendfile/connect:AgentVersion.h:0/9) WineRunWineTest.pl:error: BotError: The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died) WineRunWineTest.pl:error: Giving up after 3 run(s)
Done, thanks.