-- v4: pointers initlialized added test_GetAdaptersAddressesSizeZeroParam
From: John Freeman john@freemania.pro
missing semi-colon
updated comment before test to more accurately reflect that test is to see if response from GetAdaptersAddresses is correct from a size null pointer
test method name shorted to test_GetAdaptersAddresses comments changed to block style --- dlls/iphlpapi/tests/iphlpapi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index cd192003345..1f588c27086 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -67,7 +67,7 @@ static DWORD (WINAPI *pParseNetworkString)(const WCHAR*,DWORD,NET_ADDRESS_INFO*, static DWORD (WINAPI *pNotifyUnicastIpAddressChange)(ADDRESS_FAMILY, PUNICAST_IPADDRESS_CHANGE_CALLBACK, PVOID, BOOLEAN, HANDLE *); static DWORD (WINAPI *pCancelMibChangeNotify2)(HANDLE); - +static DWORD (WINAPI *pGetAdaptersAddresses)(ULONG, ULONG, void*, IP_ADAPTER_ADDRESSES*, ULONG*); DWORD WINAPI ConvertGuidToStringA( const GUID *, char *, DWORD ); DWORD WINAPI ConvertGuidToStringW( const GUID *, WCHAR *, DWORD ); DWORD WINAPI ConvertStringToGuidW( const WCHAR *, GUID * ); @@ -88,6 +88,7 @@ static void loadIPHlpApi(void) pParseNetworkString = (void *)GetProcAddress(hLibrary, "ParseNetworkString"); pNotifyUnicastIpAddressChange = (void *)GetProcAddress(hLibrary, "NotifyUnicastIpAddressChange"); pCancelMibChangeNotify2 = (void *)GetProcAddress(hLibrary, "CancelMibChangeNotify2"); + pGetAdaptersAddresses = (void *)GetProcAddress(hLibrary, "GetAdaptersAddresses"); } }
@@ -2913,6 +2914,20 @@ static void test_compartments(void) id = GetCurrentThreadCompartmentId(); ok(id == NET_IF_COMPARTMENT_ID_PRIMARY, "got %u\n", id); } +/* +* Test passes no parameters of importance but returns error if size passed into +* GetAdaptersAddresses is a null pointer and is Ok if the returned value is ERROR_INVALID_PARAMETER +*/ +static void test_GetAdaptersAddresses(void) +{ + ULONG family = 0; + ULONG flags = 0; + void *reserved; + IP_ADAPTER_ADDRESSES *aa; + ULONG *size; + ULONG err = GetAdaptersAddresses(family, flags, reserved, aa, size); + ok(err == ERROR_INVALID_PARAMETER, "got %ld\n", err); +}
START_TEST(iphlpapi) { @@ -2949,6 +2964,7 @@ START_TEST(iphlpapi) test_NotifyUnicastIpAddressChange(); test_ConvertGuidToString(); test_compartments(); + test_GetAdaptersAddressesSizeZeroParamReturnInvalidParameterError(); freeIPHlpApi(); } }
From: "John H. Freeman" john@freemania.pro
--- dlls/iphlpapi/tests/iphlpapi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 1f588c27086..36da9cd0da8 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -2922,9 +2922,9 @@ static void test_GetAdaptersAddresses(void) { ULONG family = 0; ULONG flags = 0; - void *reserved; - IP_ADAPTER_ADDRESSES *aa; - ULONG *size; + void *reserved = 0; + IP_ADAPTER_ADDRESSES *aa = 0; + ULONG *size = 0; ULONG err = GetAdaptersAddresses(family, flags, reserved, aa, size); ok(err == ERROR_INVALID_PARAMETER, "got %ld\n", err); }
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.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=142315
Your paranoid android.
=== build (build log) ===
../wine/dlls/iphlpapi/tests/iphlpapi.c:2921:13: error: redefinition of ���test_GetAdaptersAddresses��� Task: The exe32 Wine build failed
=== debian11 (build log) ===
../wine/dlls/iphlpapi/tests/iphlpapi.c:2921:13: error: redefinition of ���test_GetAdaptersAddresses��� Task: The win32 Wine build failed
=== debian11b (build log) ===
../wine/dlls/iphlpapi/tests/iphlpapi.c:2921:13: error: redefinition of ���test_GetAdaptersAddresses��� Task: The wow64 Wine build failed
Fabian Maurer (@DarkShadow44) commented about dlls/iphlpapi/tests/iphlpapi.c:
{ ULONG family = 0; ULONG flags = 0;
- void *reserved;
- IP_ADAPTER_ADDRESSES *aa;
- ULONG *size;
- void *reserved = 0;
- IP_ADAPTER_ADDRESSES *aa = 0;
- ULONG *size = 0;
Why not merge this into the previous commit?
Fabian Maurer (@DarkShadow44) commented about dlls/iphlpapi/tests/iphlpapi.c:
id = GetCurrentThreadCompartmentId(); ok(id == NET_IF_COMPARTMENT_ID_PRIMARY, "got %u\n", id);
} +/* +* Test passes no parameters of importance but returns error if size passed into +* GetAdaptersAddresses is a null pointer and is Ok if the returned value is ERROR_INVALID_PARAMETER +*/
I'd remove this comment and put another comment directly over the tested line, like ``` /* Passing NULL for size should return ERROR_INVALID_PARAMETER */ ```
Fabian Maurer (@DarkShadow44) commented about dlls/iphlpapi/tests/iphlpapi.c:
id = GetCurrentThreadCompartmentId(); ok(id == NET_IF_COMPARTMENT_ID_PRIMARY, "got %u\n", id);
} +/* +* Test passes no parameters of importance but returns error if size passed into +* GetAdaptersAddresses is a null pointer and is Ok if the returned value is ERROR_INVALID_PARAMETER +*/ +static void test_GetAdaptersAddresses(void)
You could add the code in the already existing `test_GetAdaptersAddresses`
Fabian Maurer (@DarkShadow44) commented about dlls/iphlpapi/tests/iphlpapi.c:
test_NotifyUnicastIpAddressChange(); test_ConvertGuidToString(); test_compartments();
- test_GetAdaptersAddressesSizeZeroParamReturnInvalidParameterError();
Doesn't compile
This merge request was closed by John H. Freeman.
Closing due to being a duplicate test contained in `test_GetAdaptersAddresses` previously defined