summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-05-21add TCP data stall metricsChiachang Wang
Current metrics contains only DNS signal. Given TCP info is also considered to detection data stall, the related TCP information should be included into metrics. Bug: 150182763 Test: atest NetworkStackTests NetworkStackNextTests Test: Test with ./out/host/linux-x86/bin/statsd_testdrive 121 to ensure log properly Merged-In: I5e306299f3cf4f49c46f161cd0aa4cb40d1ab76e Change-Id: I5e306299f3cf4f49c46f161cd0aa4cb40d1ab76e
2020-05-21Remove unused permission from NetworkStackTestsMark Chien
Since TetheringCoverageTests would include NetworkStackTestsLib and tethering has unit test case that tests permission. That test would assume the test package do not define some permission and use adopt/drop shell permission to simulate whether caller hold testing permission. Remove it to avoid to be inherited by its user(TetheringCoverageTests). Bug: 154869719 Test: TetheringCoverageTests, NetworkStackTests, NetworkStackNextTests Merged-In: Iac917ddaad32ae4549b7f8d376de8492a958fbeb Change-Id: Iac917ddaad32ae4549b7f8d376de8492a958fbeb
2020-05-20Remove unused ACCESS_NETWORK_STATE permissionMark Chien
Since TetheringCoverageTests would include NetworkStackTestsLib and tethering has unit test case that tests ACCESS_NETWORK_STATE permission. That test would assume the test package do not define ACCESS_NETWORK_STATE permission and use adopt/drop shell permission to simulate whether caller hold ACCESS_NETWORK_STATE permission. Since NetworkStackTests do not use ACCESS_NETWORK_STATE permission, remove it to avoid to be inherited by its user(TetheringCoverageTests). Bug: 154869719 Test: TetheringCoverageTests, NetworkStackTests, NetworkStackNextTests Merged-In: Ic45add1eaed0bd30788544b1b5bfd0f39a85a364 Change-Id: Ic45add1eaed0bd30788544b1b5bfd0f39a85a364
2020-05-20Fix flakes in testMultipleProbesRemi NGUYEN VAN
If a conclusive probe finishes before other probes start, some probes may not call Network#openConnection, as the executor is shut down immediately. Test: atest NetworkMonitorTest#testMultipleProbesOnValidNetwork \ --rerun-until-failure 500 Bug: 139314310 Original-Change: https://android-review.googlesource.com/1299380 Merged-In: Ica21c23af0472edc6ead123365b39e42e69f85cb Change-Id: Ica21c23af0472edc6ead123365b39e42e69f85cb
2020-05-20Rename variables and methods specificallyChiachang Wang
Bug: 150182763 Test: atest NetworkStackTests Merged-In: I646b4b58df20d1a280c0f472b4573dc350349cc3 Change-Id: I646b4b58df20d1a280c0f472b4573dc350349cc3
2020-05-19Support MirrorLink DHCPDECLINE.Xiao Ma
Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I9f558ce0838c87d9bb0ef519ee7c91e16f3bb066 Change-Id: I9f558ce0838c87d9bb0ef519ee7c91e16f3bb066
2020-05-18Refactor DHCP server with StateMachine.Xiao Ma
To support DHCPDECLINE message and request a new prefix from IpServer, a WaitState is required to wait until IpServer allocates a different prefix and completes configuring this prefix/route. Then server could resume from pausing DHCP packets listening. From this point, StateMachine is easier to add a WaitState for implementation. Refactor DHCP server by replacing ThreadHandler with StateMachine first. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Test: manual test: connect wifi, turn on hotspot, downstream device attaches to hotspot successfully, then turn off hotspot, repeat multiple times. Merged-In: I6c09d9c371e9c4e71d8ba26adaed640e3b97437b Change-Id: I6c09d9c371e9c4e71d8ba26adaed640e3b97437b
2020-05-18Merge changes I86cb5af0,I706e40db into rvc-devRemi NGUYEN VAN
* changes: Fix dumpVersion for IpMemoryStore on Q Log interface hash in NetworkStack dumpsys version
2020-05-15Do not mock shim in TcpSocketTrackerTestRemi NGUYEN VAN
Instead of mocking the shim, the test needs to run only on platforms that support the feature, and can provide test versions of the underlying objects (here Network). Also move the SDK version check to TcpSocketTracker itself, as users of TcpSocketTracker should not be able to set isTcpInfoParsingSupported to true on Q. Bug: 143586229 Test: atest NetworkStackTests NetworkStackNextTests on Q and R Change-Id: I580ae9ded468d3f08da336b160596484938bf2a5 Merged-In: I580ae9ded468d3f08da336b160596484938bf2a5 (cherry picked from commit 3ad1d5f0fbfff40d3dc66c3c68f103a9b2d3f5ef)
2020-05-15Move common apishim classes to apishim.common pkgRemi NGUYEN VAN
This provides a better separation of the classes based on their role (an actual shim, or an interface or utility common to all shims), and forces the apishim package to import the common classes, which makes it easier at SDK bump time since the imports do not need to be added at that point. Bug: 143586229 Test: atest NetworkStackTests Original-Change: https://android-review.googlesource.com/1310517 Merged-In: Ie77c17a96a67016f35890afa065bea0a07b09504 Change-Id: Ie77c17a96a67016f35890afa065bea0a07b09504
2020-05-15Log interface hash in NetworkStack dumpsys versionRemi NGUYEN VAN
The hash is logged similarly to how version code was logged, and will be used to verify that valid interfaces are used to communicate with NetworkStack. Bug: 137328719 Test: atest NetworkStackTests:NetworkStackServiceTest Original-Change: https://android-review.googlesource.com/1293755 Merged-In: I706e40dbe884ffa545f9127e29616a65d5f69c53 Change-Id: I706e40dbe884ffa545f9127e29616a65d5f69c53
2020-05-13Add test for NetworkStackService dumpsys versionRemi NGUYEN VAN
The test verifies that each method on INetworkStackConnector updates the version received from the remote, and that the output of dumpsys version matches the expected template. This logic will be changed in R to include interface hashes, so a test is important to verify that Q behavior remains the same to avoid breaking Q conformance tests. Test: atest NetworkStackTests:NetworkStackServiceTest Bug: 137328719 Original-Change: https://android-review.googlesource.com/1293754 Merged-In: Icaab91d2cb4c62930f969612545e369f09f1b0c7 Change-Id: Icaab91d2cb4c62930f969612545e369f09f1b0c7
2020-05-12Merge "Finish mocking in finally clause" into rvc-devRemi NGUYEN VAN
2020-05-10Test that IFA_F_STABLE_PRIVACY appears in LinkAddresses.Lorenzo Colitti
Bug: 150644681 Test: test-only change Original-Change: https://android-review.googlesource.com/1295495 Merged-In: I4b7a489ae80d00d57b3c3d6e6ecebdf3bc581fd5 Change-Id: I4b7a489ae80d00d57b3c3d6e6ecebdf3bc581fd5
2020-05-10Use doIpv6Provisioning in testPref64Option.Lorenzo Colitti
This is a simple refactoring to reduce code duplication, and it shows that it's possible to use doIpv6Provisioning in tests that also need to place their own expectations on LinkProperties around provisioning time. Bug: 152723363 Bug: 153694684 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testPref64Option --iterations 100 Change-Id: Iaa3e297e2417d4cdf9393baf27d61657e5743888
2020-05-08Merge "Set clientId when parsing an explicit DHCP_CLIENT_IDENTIFIER option." ↵TreeHugger Robot
into rvc-dev
2020-05-08Verify the IP addresses from IPv6-only provisioning look correct.Lorenzo Colitti
Currently, the IPv6-only tests in IpClientIntegrationTest check that there are 3 IPv6 addresses, but not what type of addresses they are. Check that one is a link-local address, one is a stable privacy address, and one is a privacy address. Bug: 152723363 Test: test-only change Original-Change: https://android-review.googlesource.com/1295491 Merged-In: I285952a9a1476c694e54b6bc27ec757fd5d8eb50 Change-Id: I285952a9a1476c694e54b6bc27ec757fd5d8eb50
2020-05-08Merge "Update default value of probe url to be a constant" into rvc-devChiachang Wang
2020-05-08Finish mocking in finally clauseTreehugger Robot
Failure of testIpClientServiceAvailableAfterPolling could cause tests in the same process to fail because the mockito session is not finalized. Use try / finally to make sure finishMocking is called. Test: atest ModuleNetworkStackClientTest Bug: 139314310 Original-Change: https://android-review.googlesource.com/1299389 Merged-In: I95cc24e789c5af5f655c875314ed97f50121166c Change-Id: I95cc24e789c5af5f655c875314ed97f50121166c
2020-05-07Merge "Set jni_uses_sdk_apis for NetworkStackTests" into rvc-devColin Cross
2020-05-07Merge "Fix the potential NPE when starting provisioning with FILS." into rvc-devXiao Ma
2020-05-07Merge "Test that the system doesn't accept non-/96 NAT64 prefixes." into rvc-devLorenzo Colitti
2020-05-07Fix the potential NPE when starting provisioning with FILS.Xiao Ma
Starting provisioning with enabled FILS is unlike the normal case that always happens after L2 connection has been established, at this point we already know the current bssid. However, for FILS connection, the current bssid is still null when starting prov. Bug: 155696520 Test: atest NetworkStackTests NetworkStackIntegrationTests Merged-In: I3c29c6ad95c23cea2b3f374fb9dc35a8f54a6427 Change-Id: I3c29c6ad95c23cea2b3f374fb9dc35a8f54a6427
2020-05-07Set clientId when parsing an explicit DHCP_CLIENT_IDENTIFIER option.Xiao Ma
Bug: 130741856 Test: atest NetworkStackTests TetheringTests Test: manually turn on the hotspot and verify the downstream device can attach to the upstream hotspot, then turn it off, repeat multiple times. Merged-In: I9da5fec47a74de36869e795fa9b1d7170d2f91c9 Change-Id: I9da5fec47a74de36869e795fa9b1d7170d2f91c9
2020-05-07Update default value of probe url to be a constantChiachang Wang
Default value for probing url should be a constant in NetworkStack but not an overlayable config due to some technical limitations. OEMs can mistakenly override configs that were not designed to be overridden. Bug: 152730542 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I1846958e7c4e8b64ae287718c63e705bb232632a Merged-In: I1846958e7c4e8b64ae287718c63e705bb232632a
2020-05-07Set jni_uses_sdk_apis for NetworkStackTestsColin Cross
NetworkStackTests doesn't set sdk_version but needs portable versions of its JNI libraries. Set jni_uses_sdk_apis, and remove the extra JNI libraries that don't have SDK variants. Bug: 154665579 Test: atest NetworkStackCoverageMtsConfigTests on a Q device Change-Id: Ieff8acec71d206104033a04c049840fd94adfce9
2020-05-06Test that the system doesn't accept non-/96 NAT64 prefixes.Lorenzo Colitti
Other system components (clatd, netd's DNS64 synthesis) don't support non-/96 prefixes, so such prefixes must be ignored. CTS already checks that LinkProperties#setNat64Prefix throws IllegalArgumentException when passed an invalid prefix length. Here we test that nothing happens (e.g., the network stack doesn't crash) when that exception is thrown. Bug: 153694684 Test: new unit tests Change-Id: I8a57e171d472532b930c8d5c33e11a99024cf128
2020-05-06Add EvaluatingBandwidthState to evaluate network bandwidthLucas Lin
Add a new state between EvaluatingPrivateDnsState and ValidatedState to evaluate the network bandwidth. This state is optional, OEMs can overlay the resource file and set the related config to enable this feature. Bug: 133522566 Test: atest NetworkStackTests Change-Id: I4b43450ad7ed4284bf433b0daab8d0c00d4c284e Merged-In: Ia2d6e4b8e434c15e76bc9e58874c40b1647f97fb (cherry picked from commit 679809049207e48a63fde4f00f1084a3ea287dc1)
2020-05-05[SP18.2] Create TestableNetworkStatsProviderCbBinderJunyu Lai
Currently, in OffloadController unit test, mock object is used to verify callback sent from provider. However, verify a mock method running in different thread, is not supported if there is no additional thread synchronization mechanism applied. This is fine now since all the callbacks fired from OffloadControllerTest are on the same thread with caller. But it is not necessary true in subsequent patches that fire callbacks from handler thread. Hence, introduce a testable provider callback that based on a thread-safe ArrayTrackRecord to provide the functionality to verify mock callback fired in a different thread. Test: m -j Bug: 149467454 Change-Id: I2edf887ccee5f205368a294f5f9990edb818332d Merged-In: I2edf887ccee5f205368a294f5f9990edb818332d (cherry picked from commit bdd1690cef97c246405b43ec0d9ccea1ede5703b)
2020-05-04Don't crash if the PREF64 expires when IpClient is stopped.Lorenzo Colitti
Currently the code does not cancel the PREF64 alarm when IpClient is stopped. If the alarm fires when IpClient has disconnected, it will call updatePref64 with a null prefix, which will crash. Ensure that the alarm is cancelled when IpClient is stopped. Bug: 153694684 Bug: 155559286 Test: new unit tests Change-Id: I397eb36c1a8ecf1324de33e720577fe2e4e07056
2020-05-02Fix testIpClientServiceAvailableAfterPollingRemi NGUYEN VAN
The test used NetworkStack.setServiceForTest(null) expecting that null would be returned in NetworkStack.getService, which is incorrect: using null just causes getService to use default system behavior, which returns the actual service. Bug: 139314310 Test: atest ModuleNetworkStackClientTest --rerun-until-failure 500 Original-Change: https://android-review.googlesource.com/1299379 Merged-In: I2d607d3ab26bcecd20546041ac4be2892a3fb852 Change-Id: I2d607d3ab26bcecd20546041ac4be2892a3fb852
2020-05-01Fix potential exceptions in FdEventReader usersRemi NGUYEN VAN
In particular, - Fix a possible NPE In IpNeighborMonitor, if a NUD_FAILED is received for some neighbor before all other neighbors have received RTM_NEWNEIGH. - Add try / catch in IpNeighborMonitor, DhcpPacketListener, ConnectivityPacketTracker in case some unexpected exception is thrown while processing packets. - Add Log.wtf logging in FdEventsReader in case any such exception is missed. Bug: 152842850 Test: atest NetworkStackTests Original-Change: https://android-review.googlesource.com/1274609 Merged-In: Ia03fec358e98b3f218220e70fc3265e14ca15f78 Change-Id: Ia03fec358e98b3f218220e70fc3265e14ca15f78
2020-05-01Merge "Wait for IpClient.StoppedState#enter before tests" into rvc-devRemi NGUYEN VAN
2020-05-01Merge "Add test configuration values for probe URLs" into rvc-devRemi NGUYEN VAN
2020-05-01Wait for IpClient.StoppedState#enter before testsRemi NGUYEN VAN
IpClientIntegrationTest is flaky because some mocks that IpClient uses, like mNetd, can be stubbed while IpClient is initializing in its handler thread. This generates UnfinishedStubbingExceptions as IpClient is calling methods on the mock while the test is trying to stub additional methods. Wait for IpClient to become idle before doing any further setup. Bug: 152723363 Test: atest NetworkStackCoverageTests:IpClientIntegrationTests --rerun-until-failure [lots] on Q Cuttlefish Original-Change: https://android-review.googlesource.com/1298472 Merged-In: I90206a16fff1fa12ca7e37e36d49163b6a83e5c1 Change-Id: I90206a16fff1fa12ca7e37e36d49163b6a83e5c1
2020-04-30Merge changes I9d38c696,I8da6a8f4 into rvc-devRemi NGUYEN VAN
* changes: Fix IpReachabilityMonitorTest flakes/Q failures Add tests for IpReachabilityMonitor
2020-04-30Fix IpReachabilityMonitorTest flakes/Q failuresRemi NGUYEN VAN
IpReachabilityMonitor was failing on Q because of: - Usage of HexEncoding.encodeToString(byte[], boolean) that did not exist in Q - Flakes/failures caused by missing permissions when calling IpConnectivityLog - Flakes caused by mocking FileDescriptor#valid() while it could be accessed from another thread Bug: 152723363 Test: atest IpReachabilityMonitorTest --rerun-until-failure 500 Merged-In: I9d38c696bf1b3b63be3b9df3161168ee291e7beb Change-Id: I9d38c696bf1b3b63be3b9df3161168ee291e7beb (cherry picked from commit 162c7ee3601b49f55b7a72597067bc93836dbb96)
2020-04-30Add test configuration values for probe URLsRemi NGUYEN VAN
The test configuration values override RROs that may have been set by OEMs, which is necessary to be able to rely on them in CTS tests. Test: atest NetworkStackTests Bug: 152280218 Merged-In: I8171fd6360a6e504f3abaea3d7de4fa308bbb35b Change-Id: I8171fd6360a6e504f3abaea3d7de4fa308bbb35b
2020-04-28Address comments on NetworkStack AIDL v6Remi NGUYEN VAN
Address issues found during AIDL review: - Rename clientAddr to singleClientAddr - Do not use a ParcelableBundle for notifyNetworkTested or notifyDataStallSuspected; instead use AIDL parcelables for stronger backwards compatibility guarantees. As part of moving notifyNetworkTested to using a parcelable the test result int is split into two: the actual evaluation result, and the probesSucceeded int. It used to contain both as a bit mask, which does not make sense if probesAttempted is in a separate int itself. Test: atest NetworkMonitorTest ConnectivityServiceTest ConnectivityServiceIntegrationTest, manual Bug: 153500847 Merged-In: I4aac6ff7432472f8a9345fb5785c6314ec8946e4 Change-Id: I4aac6ff7432472f8a9345fb5785c6314ec8946e4
2020-04-27Add a ShimUtils.isAtLeastR() and use it in tests.Treehugger Robot
Bug: 152723363 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest NetworkStackNextTests NetworkStackNextIntegrationTests Original-Change: http://aosp/1295494 Merged-In: I88c33a48a627008f5ad7f880bd09c568866b1c5b Change-Id: I88c33a48a627008f5ad7f880bd09c568866b1c5b
2020-04-26Merge "Speed up the DHCP roaming tests." into rvc-devLorenzo Colitti
2020-04-26Speed up the DHCP roaming tests.Lorenzo Colitti
The DHCP roaming tests all call doDhcpRoamingTest. This method appears to want to have the IpMemoryStore return null, but instead just causes DhcpClient's IpMemoryStore query to time out. Fix this by actually calling the onNetworkAttributesRetrieved callback with null. Before: real 0m43.728s After: real 0m38.660s Bug: 152723363 Test: atest NetworkStackNextIntegrationTests Original-Change: http://aosp/1295489 Merged-In: I6fc93f82fda6891b3973d04e30cdfce6563077a1 Change-Id: I6fc93f82fda6891b3973d04e30cdfce6563077a1
2020-04-26Deflake testRaRdnss.Lorenzo Colitti
This test is flaky because sometimes provisioning succeeds as soon as the link-local and stable address appear. This causes future expectations on LinkProperties update callbacks to get confused because they see the addition of the privacy address instead of the change they are expecting. Ensure that if provisioning completes with two addresses we explicitly wait for and consume the update that contains the privacy address. Bug: 152723363 Test: atest NetworkStackIntegrationTests:IpClientIntegrationTest#testRestoreInitialInterfaceMtu_WithException --iterations 100 Original-Change: http://aosp/1295487 Merged-In: Ibdd16ce0285db20bd700bf4e78762b922b4661d4 Change-Id: Ibdd16ce0285db20bd700bf4e78762b922b4661d4
2020-04-25Speed up IpClientIntegrationTest.Lorenzo Colitti
1. Ensure the IpMemoryStore always immediately answers questions from the DHCP client. Otherwise, starting the DHCP client takes two seconds as the query to the IpMemoryStore times out. This does not affect tests that use the IpMemoryStore because unlike when(), doAnswer() can be called multiple times. 2. Disable IPv6 provisioning delays before every test, instead of requiring every test to do it individually. 3. Disable DAD as well as setting router solicitation delay to 0. This results in the IP stack essentially immediately after IpClient is told to start. This speeds up the test by about 2x. Before: $ time atest -ti NetworkStackIntegrationTests:IpClientIntegrationTest ... real 1m21.375s After: $ time atest -ti NetworkStackIntegrationTests:IpClientIntegrationTest ... real 0m41.642s Bug: 152723363 Test: test-only change Original-Change: http://aosp/1295486 Merged-In: I32f24ed03fde6fe7e0d0531fa2a289b7f4f88745 Change-Id: I32f24ed03fde6fe7e0d0531fa2a289b7f4f88745
2020-04-25Deflake and fix testIpClientClearingIpAddressState.Maciej Żenczykowski
This test is flaky (at least when run on device) because often IpClient is started before it has heard about the IP address that the test adds to the interface. Then, when provisioning is started, it succeeds immediately because due to historical reasons the presence of an IPv4 address is sufficient to declare a network provisioned. Attempt to configure the address in a way that will avoid this sort of race. Because IpClient does not expose information about its inner state, or send any callbacks while it's stopped, do this by tapping in to the same observer registry that the test IpClient instance uses, and adding two addresses on the assumption that when the second one is observed, all observers, including IpClient, will have seen the first one be added. Also, the test was not very realistic. It configured an IPv4 address, and then ran DHCP, and expected that the IPv4 address would be cleared by ClearingIpAddressesState. But DHCP clears the address as well, because netd only supports configuring one IPv4 address per interface, so the test is not very useful. Use IPv6 instead. Bug: 139314310 Bug: 152723363 Test: atest NetworkStackIntegrationTests:IpClientIntegrationTest#testIpClientClearingIpAddressState --iterations 100 Merged-In: Ibf2fa0260df313c604ec0be3d04f49319f02d60e Change-Id: Ibf2fa0260df313c604ec0be3d04f49319f02d60e
2020-04-25Skip tests if the shims are too old for them to pass.Lorenzo Colitti
Two tests in IpClientIntegrationTest depend on methods that require R. These tests are already ignored on Q devices. However, when running NetworkStackIntegrationTests (as opposed to NetworkStackNextIntegrationtests), the tests fail because they compile against the Q shims, and the code behaves the same way as it does on Q. Skip these tests by checking the version of the shims. Bug: 152723363 Test: atest NetworkStackIntegrationTests has two fewer failures Merged-In: I388bd58e79cd4310ad286bcc5688e96b16787be0 Change-Id: I388bd58e79cd4310ad286bcc5688e96b16787be0
2020-04-24Merge "Address comments on ag/11204387." into rvc-devTreeHugger Robot
2020-04-24Improve testable utils.Chalard Jean
Test: m gts && gts-tradefed run gts --module GtsNetworkStackHostTestCases Bug: 150643374 Change-Id: Ib1c4d8814d3199b512a552ea4c92fedad42594a0
2020-04-24Address comments on ag/11204387.Lorenzo Colitti
Add comments and slightly increase test coverage. Bug: 153694684 Test: new test coverage in IpClientIntegrationTest Change-Id: I160a0801449cbe9e66976eaacdd3a914adc3d341
2020-04-23Merge "Ensure that the NAT64 prefix is removed when its lifetime expires." ↵Lorenzo Colitti
into rvc-dev