[tests] Adjust test to work in unsupported scenarios
authorMarek Habersack <grendel@twistedcode.net>
Fri, 3 Jul 2015 10:27:45 +0000 (12:27 +0200)
committerMarek Habersack <grendel@twistedcode.net>
Wed, 15 Jul 2015 18:45:31 +0000 (20:45 +0200)
commit947e37c0286422e22a4a8ce685850f0656150f34
tree96646933a7fb4ae755c417f70cec15af912a4770
parent2378ff1a8cfd9c0fa8a32638e1298d6fa49d5fcd
[tests] Adjust test to work in unsupported scenarios

On Android (possibly on other systems too) it is possible that no gateway address is available and its lack is NOT an error
Here is a sample of /proc/net/route from Nexus 9 running Android 5.1.1 (IPInterfaceProperties parses that file on Linux)

  Iface Destination Gateway  Flags RefCnt Use Metric Mask MTU Window IRTT
  wlan0 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0

Gateway is set to any address and it is explicitly ignored by the route information parser

For comparison, here's route contents from an Android 4.4.4 device:

  Iface Destination Gateway  Flags RefCnt Use Metric Mask MTU Window IRTT
  wlan0 00000000 0101A8C0 0003 0 0 0 00000000 0 0 0
  wlan0 00000000 0101A8C0 0003 0 0 203 00000000 0 0 0
  wlan0 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
  wlan0 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
  wlan0 0001A8C0 00000000 0001 0 0 203 00FFFFFF 0 0 0
  wlan0 0101A8C0 00000000 0005 0 0 0 FFFFFFFF 0 0 0

Obviously, this test fails on the first device and succeeds on the second. For this reason the test is modified to succeed
in case of devices like the first one since it's not a real failure but a shortcoming of the .NET API
mcs/class/System/Test/System.Net.NetworkInformation/IPInterfacePropertiesTest.cs