Bruno Jesus : iphlpapi/tests: Test route type and protocol in GetIpForwardTable.

Alexandre Julliard julliard at winehq.org
Tue Mar 7 15:43:59 CST 2017


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

Author: Bruno Jesus <bjesus at codeweavers.com>
Date:   Mon Mar  6 01:24:32 2017 -0300

iphlpapi/tests: Test route type and protocol in GetIpForwardTable.

Signed-off-by: Bruno Jesus <bjesus at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/iphlpapi/tests/iphlpapi.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c
index 953bbc9..bc99660 100644
--- a/dlls/iphlpapi/tests/iphlpapi.c
+++ b/dlls/iphlpapi/tests/iphlpapi.c
@@ -355,7 +355,7 @@ static void testGetIpForwardTable(void)
        "GetIpForwardTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
        apiReturn);
 
-      if (apiReturn == NO_ERROR && winetest_debug > 1)
+      if (apiReturn == NO_ERROR)
       {
           DWORD i;
 
@@ -363,11 +363,31 @@ static void testGetIpForwardTable(void)
           for (i = 0; i < buf->dwNumEntries; i++)
           {
               char buffer[100];
+
+              if (!U1(buf->table[i]).dwForwardDest) /* Default route */
+              {
+todo_wine
+                  ok (U1(buf->table[i]).dwForwardProto == MIB_IPPROTO_NETMGMT,
+                  "Unexpected dwForwardProto %d\n", U1(buf->table[i]).dwForwardProto);
+                  ok (U1(buf->table[i]).dwForwardType == MIB_IPROUTE_TYPE_INDIRECT,
+                  "Unexpected dwForwardType %d\n",  U1(buf->table[i]).dwForwardType);
+              }
+              else
+              {
+                  /* In general we should get MIB_IPPROTO_LOCAL but does not work
+                   * for Vista, 2008 and 7. */
+                  ok (U1(buf->table[i]).dwForwardProto == MIB_IPPROTO_LOCAL ||
+                      broken(U1(buf->table[i]).dwForwardProto == MIB_IPPROTO_NETMGMT),
+                  "Unexpected dwForwardProto %d\n", U1(buf->table[i]).dwForwardProto);
+                  /* The forward type varies depending on the address and gateway
+                   * value so it is not worth testing in this case. */
+              }
+
               sprintf( buffer, "dest %s", ntoa( buf->table[i].dwForwardDest ));
               sprintf( buffer + strlen(buffer), " mask %s", ntoa( buf->table[i].dwForwardMask ));
-              trace( "%u: %s gw %s if %u type %u\n", i, buffer,
-                     ntoa( buf->table[i].dwForwardNextHop ),
-                     buf->table[i].dwForwardIfIndex, U1(buf->table[i]).dwForwardType );
+              trace( "%u: %s gw %s if %u type %u proto %u\n", i, buffer,
+                     ntoa( buf->table[i].dwForwardNextHop ), buf->table[i].dwForwardIfIndex,
+                     U1(buf->table[i]).dwForwardType, U1(buf->table[i]).dwForwardProto );
           }
       }
       HeapFree(GetProcessHeap(), 0, buf);




More information about the wine-cvs mailing list