Commit graph android_packages_modules_Co.../tests
Message SHA1
[MS68.4] Address comments at aosp/1958144
Test: atest TrafficStatsTest NetworkUsageStatsTest FrameworksNetTests
Bug: 204830222
Ignore-AOSP-First: merge conflict

(cherry-picked from ag/16811186)

Change-Id: I2578e13e2844591adac1d1902f2454ec7079ceea
Merged-In: I2578e13e2844591adac1d1902f2454ec7079ceea

Frank   commited 2022-03-02 03:09:09 +08:00
eeeb76d3bb
Merge "Add some debugs to diagnose test failure."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2022-03-01 01:05:01 +00:00
87db609348
Merge "Move assumptions out of BeforeClass annotated method"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-28 11:07:04 +00:00
d239146987
Merge changes from topic "ms52-movenetstats"
* changes:
  Update API files to unhide MATCH_PROXY.
  Update tests for NetworkStats code move.
  Add setPollForce to module API
  Add JNI stats libraries to apex Android.bp
  Add JNI stats libraries to connectivity
  [MS62.2] Add NetworkStatsService into service initializer
  [MS54.8] Add hiddenapi-unsupported-t.txt to apex Android.bp
  [MS54.3] Move NetworkStats to updatable sources

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-28 05:32:23 +00:00
cebdfba1bb
Update tests for NetworkStats code move.
NetworkStatsFactory is moving from services.core to
service-connectivity-tiramisu. Update FrameworksNetSmokeTests and
FrameworksNetIntegrationTests to depend on the latter instead of the
former.

Test: atest FrameworksNetSmokeTests FrameworksNetIntegrationTests
Ignore-AOSP-First: part of large internal topic to avoid merge conflicts
  (cherry-picked from ag/16786005)
Change-Id: Ie48dac421decf83440b7c88adea18152e05f03bb
Merged-In: Ie48dac421decf83440b7c88adea18152e05f03bb

Lorenzo Colitti   authored and   Junyu Lai   commited 2022-02-28 04:17:13 +00:00
3d52172838
Add JNI stats libraries to connectivity
Add new symbols to libservice-connectivity loaded on T only, and the
framework libraries to apex and tests.

Bug: 197717846
Test: atest FrameworksNetTests
  (cherry-picked and splitting apex Android.bp to aosp/1994130)
Change-Id: Iae44344701a3267110e5cbf271120201134d59e5
Merged-In: Iae44344701a3267110e5cbf271120201134d59e5

Remi NGUYEN VAN   authored and   Junyu Lai   commited 2022-02-28 04:16:17 +00:00
d95048929c
Merge "Fix HostsideVpnTests flakyness"
Taras Antoshchuk   authored and   Gerrit Code Review   commited 2022-02-25 12:02:13 +00:00
116bd6e1a2
Merge "Make sure the right NetworkMonitor start method is called on S-/T+"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-25 02:23:09 +00:00
894912c85e
Merge "Fix a flake where network caps change innocuously."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-24 11:53:04 +00:00
da5e11c95f
Add some debugs to diagnose test failure.
Bug: 218308105
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I096258d8c55cf56478015a655b5f3be19f29ace1
Merged-In: I096258d8c55cf56478015a655b5f3be19f29ace1

Sudheer Shanka   commited 2022-02-23 20:37:30 +00:00
5f09f8da8c
Move assumptions out of BeforeClass annotated method
Assumptions that are placed in BeforeClass annotated methods are not
reported correctly. See b/203722419 for more information.

Test: atest RateLimitTest
Bug: 220801455
Change-Id: Ia7f0eaddc75d0ee091e107615f1677c75865dbcb

Patrick Rohr   commited 2022-02-23 10:53:20 +01:00
9fa0b3bf18
Merge "Add proper kernel support assumption to RateLimitTest"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-22 20:43:22 +00:00
3dd5cc1631
Fix a flake where network caps change innocuously.
Caps are changing before the code is checking for no callback,
but the network is not validating ; something like RSSI or
link speed has been updated, which is fine as long as the
network doesn't validate.

Test: ConnectivityManagerTest
Change-Id: Ie9a167d3599b0157cc1cf6e93c36e9689e9cc2e0

Chalard Jean   commited 2022-02-23 04:52:04 +09:00
c46c3b55da
Merge "Fix : recent Connectivity module with old NetworkStack module"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-22 19:32:54 +00:00
b30e957777
Make sure the right NetworkMonitor start method is called on S-/T+
Test: ConnectivityServiceTest
Change-Id: I6a7f0143082236e30d2e3878147df2c921ff5539

Chalard Jean   commited 2022-02-23 04:31:26 +09:00
cd8210843f
Add proper kernel support assumption to RateLimitTest
As it turns out, /proc/config.gz can be accessed via shell command from
within a CTS test. This adds a proper kernel support check for the
RateLimitTest.

Bug: 220801455
Test: atest RateLimitTest
Change-Id: I4d3a6848c1c05c313cb74b235294cee982eecf57

Patrick Rohr   commited 2022-02-22 15:55:30 +01:00
2140575fce
Merge "Run CTS EthernetNetworkSpecifier in 12"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-22 12:47:12 +00:00
7a195e16c6
Merge changes Ie68356a4,I2b63c24b
* changes:
  Attempt to deflake NetworkAgentTest#testRejectedUpdates.
  Fix a couple of JavaDoc errors in NetworkAgentInfo.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-22 10:41:37 +00:00
d6a5303cd8
Merge changes Ib1cd342a,Iab23d414
* changes:
  Add an IS_DESTROYED flag to FullScore.
  Use MessageUtils instead of hardcoded strings in policyNameOf.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-22 09:26:38 +00:00
1c5ce5542a
Merge "Mock more resources for VPNs."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-22 09:10:42 +00:00
16040b1833
Attempt to deflake NetworkAgentTest#testRejectedUpdates.
This test is highly flaky in presubmit with error messages that
look like:

java.lang.AssertionError: Did not receive callback after 200ms

The test itself looks correct, so it's possible that 200ms just
isn't enough time for the callbacks to be delivered. Set the
timeout to DEFAULT_TIMEOUT_MS like most of the other
TestableNetworkCallbacks in this class.

Fix: 218389790
Test: test-only change
Change-Id: Ie68356a48e9618e5fea3865aa06bfbfc457b89c4

Lorenzo Colitti   commited 2022-02-22 18:04:31 +09:00
e3ef5a8024
Add an IS_DESTROYED flag to FullScore.
This is being added as the lowest priority score factor, just
above the tie-breakers. It ensures that a network that has been
destroyed will lose to another identical network that has not
been destroyed, but will otherwise be scored identically.

The flag is a CS-managed flag that is stored in NetworkAgentInfo.
Currently it is always false, but it will be populated in
future CLs.

Bug: 216567577
Test: atest FrameworksNetTests
Change-Id: Ib1cd342ab7dfc4df45715da19b743d711fe8d605

Lorenzo Colitti   commited 2022-02-22 16:39:44 +09:00
8c7a8860f9
Merge "Mock resources used directly by LockdownVpnTracker."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-22 01:59:20 +00:00
2606d9c862
Mock more resources for VPNs.
These also cause ConnectivityCoverageTests to fail when built
from master and run on S. They are used in Vpn.java, not
LockdownVpnTracker.

They were not addressed in the previous CL because running this
test locally is difficult.

Test: forrest
Change-Id: I7d687338fd6bc7468b1abcae58898322554e647b

Lorenzo Colitti   commited 2022-02-22 10:17:09 +09:00
93a72d22a5
Mock resources used directly by LockdownVpnTracker.
LockdownVpnTracker directly uses resources from
com.android.internal.R. This is acceptable because it's platform
code. But ConnectivityServiceTest uses the LockdownVpnTracker
built from the module source tree, and when that code fetches
resources on a previous Android release, it crashes because the
resource IDs don't exist; non-public resource IDs aren't stable.

Fix this by mocking the resources used by LockdownVpnTracker.

Test: atest ConnectivityCoverageTests
Change-Id: I239a18a38d4f1082f76f5ff1b831c15ee753bdfd

Lorenzo Colitti   commited 2022-02-22 10:13:24 +09:00
19e6171926
Merge "CTS for ingress rate limiting"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-21 19:57:37 +00:00
c6cf669b8d
CTS for ingress rate limiting
This test creates a TUN interface and registers it with
ConnectivityService. For 15 seconds, it continuously writes data to that
interface and measures at what rate it is received.

Data accounting is currently not covered by this test.

Test: atest RateLimitTest
Bug: 172053704
Change-Id: I74f891f3b7113855375c48a10cefbfe47221931b

Patrick Rohr   commited 2022-02-21 18:05:21 +01:00
96c1ff4ae9
Merge "Skip NetworkStatsServiceTest before T"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-19 20:20:24 +00:00
fc67ee8c71
Merge "Add tests for deleteKernelTagData"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-19 20:20:24 +00:00
8bf31e8061
Fix : recent Connectivity module with old NetworkStack module
This patch adjusts the behavior of the NetworkMonitor mock
to behave the same way as the real one – accept either
notifyNetworkConnected or notifyNetworkConnectedParcel as
a signal a network is connected. This is necessary because
the Connectivity module will call either of these depending
on versions of other software it finds on the device.

Test: ConnectivityServiceTest
      NetworkMonitorTest
Change-Id: I5900a019b3b033f4365d8a82b1e522336012064e

Chalard Jean   commited 2022-02-19 20:43:14 +09:00
a14b3f2184
Use MessageUtils instead of hardcoded strings in policyNameOf.
This makes the code easier to maintain because we do not need to
manually add string representations, and because it will throw at
static initialization time if the clas contains duplicate
POLICY_xxx values. The memory overhead is likely negligible.

Bug: 216567577
Test: new coverage in FullScoreTest
Change-Id: Iab23d414c8e28ff7f26060ad44fa996f277d361f

Lorenzo Colitti   commited 2022-02-19 19:45:43 +09:00
c6d3f3cf25
Merge "Don't check validation state in waitForAvailable(..., Network)."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-18 17:04:27 +00:00
dbb9280abc
Merge "Fix HostsideVpnTest#testExcludedRoutes"
Taras Antoshchuk   authored and   Gerrit Code Review   commited 2022-02-18 13:25:21 +00:00
d42d1645cb
Skip NetworkStatsServiceTest before T
NetworkStatsService was mainlined in T, so the test does not need to be
run on previous Android versions.

Test: atest CtsNetTestCases:NetworkStatsServiceTest
Change-Id: I8e69746a03ef029b1121cc8fa71e299ac12c2905

Patrick Rohr   commited 2022-02-18 09:18:20 +01:00
e3b067f523
Merge "Support "dumpsys connectivity trafficcontroller""
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-17 23:10:10 +00:00
bce8cbabbb
Run CTS EthernetNetworkSpecifier in 12
EthernetNetworkSpecifier's constructor was added to @SystemApi in
Android 12. Include that release as part of running this test.

Bug: 210487893
Bug: 210485380
Test: atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetNetworkSpecifierTest

Change-Id: I1e813c38bd36b911a50137172c1f780a2ed12d1d

James Mattis   commited 2022-02-17 09:37:50 -08:00
8547fb0a87
Merge "Cleanup and refine connectivity test config"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-02-17 09:45:39 +00:00
3035f6c554
Don't check validation state in waitForAvailable(..., Network).
The version of ConnectivityManagerTest#waitForAvailable that
takes a callback and a Network implicitly requires that the
network be validated, because it calls expectAvailableCallbacks
with validated=true.

This is incorrect because a network can become available without
being validated. In particular, testMobileDataPreferredUids is
flaky due to this problem, because it calls connectToCell, which
does not wait for validation, and then calls waitForAvailable,
which expects that the network is already validated.

Fix it by not requiring any particular validation state. This
method is only used by a few tests and they should not be
affected by this change:
- The first two calls in testSetOemNetworkPreferenceForTestPref
  happen after waiting for validation, so the network is
  validated already. The third call waits for a test network,
  and test networks are always validated.
- The first call in testSetOemNetworkPreferenceForTestOnlyPref
  waits for a test network, which is always validated. The
  second is incorrect because ensureWifiConnected does not
  wait for validation, and is fixed by this CL.
- The calls in testMobileDataPreferredUids similarly incorrectly
  assume that wifi is validated and are fixed by this CL.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testMobileDataPreferredUids
Change-Id: I614d0ba87c3931fcbe4011fed379e1736f5c4a44

Lorenzo Colitti   commited 2022-02-17 18:29:11 +09:00
d2bd9db36a
Support "dumpsys connectivity trafficcontroller"
Enable ConnectivityService to dump BPF maps from libtraffic_controller.

Bug: 202086915
Test: adb shell dumpsys connectivity trafficcontroller
Test: atest CtsNetTestCases:ConnectivityManagerTest#testDumpBpfNetMaps
Test: run CTS in I021789813f116940d581e2c4a1fd357ff47bfa08
Change-Id: Ib0e935ee2b714ac61daceba6d13fa7a20f97f68f

Ken Chen   commited 2022-02-17 16:58:47 +08:00
e6d511f785
Merge "DscpPolicyTest Check Kernel Version"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-17 07:15:11 +00:00
5a2f079722
Merge "CTS tests for EthernetNetworkSpecifier"
James Mattis   authored and   Gerrit Code Review   commited 2022-02-17 03:10:36 +00:00
700774f34e
CTS tests for EthernetNetworkSpecifier
Bug: 210485380
Test: atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetNetworkSpecifierTest

Change-Id: I080bc111aa57c7889a6bf9564b8fc2c1dddd944d

James Mattis   commited 2022-02-16 16:46:49 -08:00
deaeefb283
Merge "Fix NetworkStatsServiceTest after adding deleteKernelTagData"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-16 19:59:14 +00:00
3226bfb631
Cleanup and refine connectivity test config
Remove the include for Connectivity/Tethering TEST_MAPPING as there is
no such file in that directory, add comments on ConnectivityModuleTest
usage, and skip the whole NetworkAgentTest on non-connectivity module
MTS runs.

Bug: 218611855
Test: atest CtsNetTestCasesLatestSdk
Change-Id: Id96ab8a5ae631b0c64f20faedd4a0430eb9318d4

Remi NGUYEN VAN   commited 2022-02-16 20:34:31 +09:00
73da478927
Merge "Skip BpfExistenceTest#TestPrograms on BPF unsupported device"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-16 11:22:47 +00:00
7d30b56f06
Skip BpfExistenceTest#TestPrograms on BPF unsupported device
BPF is supported after kernel 4.9. Skip the test on BPF
unsupported device. Ex: walleye.

Bug: 219696135
Test: atest bpf_existence_test on walleye
Change-Id: I583a858587c0501582c9e77c8b584b3136312cd5

Hungming Chen   commited 2022-02-16 16:06:59 +08:00
0456900bf2
Add tests for deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I6db6b79314868271f877acf2a0b21699cbf02df5

Patrick Rohr   authored and   markchien   commited 2022-02-16 14:23:30 +08:00
f9888898e3
Fix testing with/without connectivity module
Add missing @ConnectivityModuleTest annotations to tests that cover
functionalities that were introduced in a newer connectivity module
update.

Also add CtsNetTestCasesLatestSdk to postsubmit with only APK modules
installed, and with only the connectivity/tethering module installed.
This can then be moved to presubmit to catch such issues before they are
merged.

While doing this cleanup the TEST_MAPPING file in tests/ and merge its
contents into the root TEST_MAPPING file. This does not change anything
for "postsubmit" tests as they are run independently of changes. It only
causes FrameworksNetIntegrationTests to run in presubmit on any change
in modules/Connectivity/ instead of only on modules/Connectivity/tests/
changes, which is how it should be.

Bug: 218611855
Test: TH needs to test TEST_MAPPING
Change-Id: I26629a35d8c2df3db33180ecc22d49d538ad3b8b

Remi NGUYEN VAN   commited 2022-02-16 15:22:30 +09:00
3b81323e4a
Fix NetworkStatsServiceTest after adding deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I667a5d86e0df8505fef549e598f3b4141637fb90

Patrick Rohr   authored and   markchien   commited 2022-02-16 14:01:29 +08:00
7c52b69b3e
DscpPolicyTest Check Kernel Version
Check kernel version to ensure current kernel supports
BPF logic for testcase.

Bug: 217209172
Test: atest DscpPolicyTest
Change-Id: I9e0df7d2e4eb320bd5324e2d13410bd960b75174

Tyler Wear   commited 2022-02-16 04:53:19 +00:00
c2926f45f2