-
Notifications
You must be signed in to change notification settings - Fork 544
[tests] Fix network interface tests for Android 30 #4868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context: https://developer.android.com/preview/behavior-changes-11#netlink-mac Context: https://developer.android.com/reference/java/net/NetworkInterface#getNetworkInterfaces() If an application targets `Android 11`/`API 30` (and newer) then the number of reported interfaces as well as the amount of information about them change to include less detail. First of all, only interfaces with associated IP addresses will be reported by both the `NetworkInterface` Java API and the `getifaddrs(3)` native libc API: * Application targetting API 28 on API 30 device: * name: wlan0; type: Ethernet * name: dummy0; type: Ethernet * name: lo; type: Loopback * name: hwsim0; type: Unknown * name: ip6tnl0; type: Tunnel * name: sit0; type: Tunnel * name: ip6_vti0; type: Tunnel * name: ip_vti0; type: Tunnel * Application targetting API 30 on API 30 device: * name: wlan0; type: 0 * name: dummy0; type: 0 * name: lo; type: 0 Second of all, as can be seen above, device information does not include the type of interface. This bit of information is what the `DotNetInterfacesShouldEqualJavaInterfaces` test relied on so far. That change broke our `DotNetInterfacesShouldEqualJavaInterfaces` test: DotNetInterfacesShouldEqualJavaInterfaces Mono interfaces: [InterfaceInfo: Name=radio0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::d4d9:5aff:fe48:60be%11, fec0::d4d9:5aff:fe48:60be, fec0::397c:d582:6278:ca2c, 10.0.2.15>] [InterfaceInfo: Name=wlan0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::e00a:8bb6:415b:4c97%9, fec0::f925:950b:4c31:eea7, fec0::315a:4cc4:796:6915, 10.0.2.16>] [InterfaceInfo: Name=dummy0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::4c41:86ff:fe93:6354%2>] [InterfaceInfo: Name=lo, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<::1, 127.0.0.1>] Java interfaces: [InterfaceInfo: Name=dummy0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::4c41:86ff:fe93:6354%2>] [InterfaceInfo: Name=wlan0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::e00a:8bb6:415b:4c97%9, fec0::f925:950b:4c31:eea7, fec0::315a:4cc4:796:6915, 10.0.2.16>] [InterfaceInfo: Name=lo, IsLoopback=True, IsUp=True, HardwareAddress=<>, Addresses=<::1, 127.0.0.1>] [InterfaceInfo: Name=radio0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::d4d9:5aff:fe48:60be%11, fec0::d4d9:5aff:fe48:60be, fec0::397c:d582:6278:ca2c, 10.0.2.15>] Interface radio0: passed Interface wlan0: passed Interface dummy0: passed [FAIL] : dotnet#8.3 (lo not found in Java interfaces) Expected: True But was: False at System.NetTests.NetworkInterfacesTest.DotNetInterfacesShouldEqualJavaInterfaces () [0x00152] in <c0e2a2f723184a6080f550609db0528d>:0 at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) Note that both Java and Mono return the same number of interfaces, with the same names but the `lo` interface in Mono list is not marked as loopback (`IsLoopback=False`) while the corresponding Java entry reports the interface is a loopback. In order to account for the above Android changes, we now look not only at the hardware type but also at its name in order to determine whether the device is a loopback one or not.
0449d24
to
b3c6ca3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change this to targetSdkVersion="30"
?
I don't think we should. We should have tests that run with different configurations, what we have now it's perfectly fine I think. |
jonathanpeppers
approved these changes
Jun 25, 2020
jonpryor
pushed a commit
that referenced
this pull request
Jun 26, 2020
Context: https://developer.android.com/preview/behavior-changes-11#netlink-mac Context: https://developer.android.com/reference/java/net/NetworkInterface#getNetworkInterfaces() If an application targets Android 11/API-30 (and later), then the number of reported network interfaces as well as the amount of information about those interfaces includes less detail. First of all, only interfaces with associated IP addresses will be reported by both the `NetworkInterface` Java API and the [**getifaddrs**(3)][0] native libc API: * Application targetting API-28 on API-30 device: * name: wlan0; type: Ethernet * name: dummy0; type: Ethernet * name: lo; type: Loopback * name: hwsim0; type: Unknown * name: ip6tnl0; type: Tunnel * name: sit0; type: Tunnel * name: ip6_vti0; type: Tunnel * name: ip_vti0; type: Tunnel * Application targetting API-30 on API-30 device: * name: wlan0; type: 0 * name: dummy0; type: 0 * name: lo; type: 0 Second of all, as can be seen above, device information does not include the type of interface. This bit of information is what the `DotNetInterfacesShouldEqualJavaInterfaces()` test relied on so far. That change breaks `DotNetInterfacesShouldEqualJavaInterfaces()`: DotNetInterfacesShouldEqualJavaInterfaces Mono interfaces: [InterfaceInfo: Name=radio0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::d4d9:5aff:fe48:60be%11, fec0::d4d9:5aff:fe48:60be, fec0::397c:d582:6278:ca2c, 10.0.2.15>] [InterfaceInfo: Name=wlan0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::e00a:8bb6:415b:4c97%9, fec0::f925:950b:4c31:eea7, fec0::315a:4cc4:796:6915, 10.0.2.16>] [InterfaceInfo: Name=dummy0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::4c41:86ff:fe93:6354%2>] [InterfaceInfo: Name=lo, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<::1, 127.0.0.1>] Java interfaces: [InterfaceInfo: Name=dummy0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::4c41:86ff:fe93:6354%2>] [InterfaceInfo: Name=wlan0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::e00a:8bb6:415b:4c97%9, fec0::f925:950b:4c31:eea7, fec0::315a:4cc4:796:6915, 10.0.2.16>] [InterfaceInfo: Name=lo, IsLoopback=True, IsUp=True, HardwareAddress=<>, Addresses=<::1, 127.0.0.1>] [InterfaceInfo: Name=radio0, IsLoopback=False, IsUp=True, HardwareAddress=<>, Addresses=<fe80::d4d9:5aff:fe48:60be%11, fec0::d4d9:5aff:fe48:60be, fec0::397c:d582:6278:ca2c, 10.0.2.15>] Interface radio0: passed Interface wlan0: passed Interface dummy0: passed [FAIL] : #8.3 (lo not found in Java interfaces) Expected: True But was: False at System.NetTests.NetworkInterfacesTest.DotNetInterfacesShouldEqualJavaInterfaces () at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) Note that both Java and Mono return the same number of interfaces, with the same names, but the `lo` interface in Mono list is not marked as a loopback (`IsLoopback=False`), while the corresponding Java entry reports the interface is a loopback. In order to account for the above Android changes, we now look not only at the hardware type but also at its name in order to determine whether the device is a loopback one or not. [0]: https://www.man7.org/linux/man-pages/man3/getifaddrs.3.html
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: https://developer.android.com/preview/behavior-changes-11#netlink-mac
Context: https://developer.android.com/reference/java/net/NetworkInterface#getNetworkInterfaces()
If an application targets
Android 11
/API 30
(and newer) then thenumber of reported interfaces as well as the amount of information about
them change to include less detail.
First of all, only interfaces with associated IP addresses will be
reported by both the
NetworkInterface
Java API and thegetifaddrs(3)
native libc API:
Second of all, as can be seen above, device information does not include
the type of interface. This bit of information is what the
DotNetInterfacesShouldEqualJavaInterfaces
test relied on so far.That change broke our
DotNetInterfacesShouldEqualJavaInterfaces
test:Note that both Java and Mono return the same number of interfaces, with
the same names but the
lo
interface in Mono list is not marked asloopback (
IsLoopback=False
) while the corresponding Java entry reportsthe interface is a loopback.
In order to account for the above Android changes, we now look not only
at the hardware type but also at its name in order to determine whether
the device is a loopback one or not.