Commit graph android_packages_modules_Co.../tests/cts/net
Message SHA1
Create CtsNetTestCasesMaxTargetSdk31.
This APK will only run tests that require target SDK 31 or below.

Bug: 233553525
Test: test-only change
Change-Id: Ia86187de50107748d8053194d3f7a55b7947412e

Lorenzo Colitti   commited 2022-05-30 23:36:21 +09:00
9e61b82404
Merge "CTS test for EthernetNetworkUpdateRequest"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-27 00:46:06 +00:00
30809dc4a1
Merge "Changing target_sdk for CtsNetTestCasesLatestSdk"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-26 10:47:01 +00:00
44ad28052c
Changing target_sdk for CtsNetTestCasesLatestSdk
Bug: 233553525
Test: Presubmit

Changing target_sdk of or CtsNetTestCasesLatestSdk to 33 to match with apps target_sdk

Change-Id: Id786f64956d52307e15b3cd3feaa02d585e7623e

preranap   commited 2022-05-26 03:00:02 +00:00
7a1639ff5f
Merge "Adding missing dependency for api23Test"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-25 23:06:58 +00:00
433f594bb6
Adding missing dependency for api23Test
Bug: 226950040
Test: Presubmit
Change-Id: I194d31e7b11b1a5efb652e2cecd3624a79d307a9

jahinimtiaz   commited 2022-05-25 17:02:46 +00:00
43d6a01d3b
Merge changes I8e806b3b,I5e8e4673,Id2a078da
* changes:
  Add CTS tests for EthernetNetworkProvider changes
  Move EthernetNetworkFactory to using the NetworkProvider API
  Improve waiting for interface added or removed

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-05-24 03:34:25 +00:00
826bdb3ec4
Add CTS tests for EthernetNetworkProvider changes
Adds CTS test to validate behavior of EthernetNetworkProvider API.
These tests are currently still pretty slow due to the fact that newly
registered tracked interfaces are brought up, back down, and back up
before they are available (this is a bug and will hopefully get fixed in
the near future).

Test: atest EthernetManagerTest
Bug: 197548738
Change-Id: I8e806b3b884f2e0b6c1a1d2fffdb9a99c5dd60e8

Patrick Rohr   commited 2022-05-23 16:50:26 -07:00
97bdb655d9
Merge "Fix test failure on S image + S module"
Paul Hu   authored and   Gerrit Code Review   commited 2022-05-23 13:45:58 +00:00
d6446263ce
Merge "Fix NsdManagerTest failures"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-05-23 02:19:36 +00:00
6235f6490e
Fix NsdManagerTest failures
- NsdManagerTest would fail on R device because the
  android.net.TestNetworkSpecifier is not existed when creating a
  test networks. Test networks are only used for those target T+
  tests. Thus, only create the test networks on T+ devices.
- Those target T+ NsdManagerTest would fail on S image because
  aosp/2098750 updated ConstantsShim to 33, so the
  ConstantsShim.VERSION check will be true. Then these tests
  will run on S image but fails with no api found. Thus, the
  pre-check should include platform check(T+).

Bug: 233200200
Bug: 232813132
Test: atest CtsNetTestCasesLatestSdk:android.net.NsdManagerTest\
      on R & S devices.
Change-Id: I246194e6e266a5e75d2f7053e0aa02ff06f11097

paulhu   authored and   Paul Hu   commited 2022-05-22 14:22:52 +00:00
2b89ae5fbb
Improve waiting for interface added or removed
In a previous CL, code was added to wait for interfaces being properly
registered with the EthernetTracker before continuing the test. The same
logic applies to removingInterfaces (which prevents a previous tests
Lost callbacks to show up in a subsequent test).
The createInterface listener was improved to expect the down callback
first. EthernetTracker receives down and up callbacks from netd which it
posts on its handler. While the initial up-up callbacks (KI) can be
flaky, down-up should always be the correct signal that the interface is
ready and properly registered with the ethernet code.

Test: atest EthernetManagerTest
Bug: 227008268
Change-Id: Id2a078da732009411934166df7ae08bedd17a19d

Patrick Rohr   commited 2022-05-20 12:48:08 -07:00
3c089e67f1
Always wait for interface to be up in EthernetManagerTest
Adds a global listener that is used to wait for an interface to show up
in EthernetTracker when it is newly created. This prevents races when
the interface is used directly after creation.

This test should fix the testCallback flakes.

Test: atest EthernetManagerTest
Bug: 227008268
Change-Id: I37d2ec63aea9f4de6010e13150bc236ee07e2f85

Patrick Rohr   commited 2022-05-19 20:21:44 -07:00
5f45a3742a
Fix test failure on S image + S module
aosp/2085868 has not included in a tethering train build and it
probably will be included in a T module release. But the test in
that CL has been put to the S MTS test. Thus, fix the test failure
on S image + S module.

Bug: 233019430
Test: atest CtsNetTestCasesLatestSdk:android.net.cts\
      .ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks
      on the S image + S module device.
Change-Id: Iafb26a1c80c48232a76050d4c8c21e2de2c21207

Paul Hu   commited 2022-05-19 08:18:15 +00:00
3891ed5eba
CTS test for EthernetNetworkUpdateRequest
Bug: 220030301
Bug: 210487893
Bug: 210485380
Test: atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetNetworkUpdateRequestTest

Change-Id: If341be56bf38a8cb1f7b17e2f8ebeda240c5a770

James Mattis   commited 2022-05-18 22:18:14 -07:00
ff0d261555
Assume all Ethernet interfaces have an MTU of 1500.
This avoids races where NetworkInterface.getByName does not return the interface
right after it is created.

Change-Id: I17a5a22034bafc30023307d5480db18e918fc042
Test: test-only change
Bug: 227008268

Lorenzo Colitti   commited 2022-05-19 02:45:16 +00:00
d0ebb64ad1
Updating Eth CTS to account for existing ifaces
Updating EthernetManagerTest to account for existing ethernet
interfaces. Specifically, testCallbacks() assumed the test interface
created would be the only ethernet interface on the device. This would
cause the test to fail if other ethernet interfaces existed.

Bug: 230305098
Test: atest CtsNetTestCases:android.net.cts.EthernetManagerTest
Change-Id: I675c4ef5c2bd96d01a057bdfec1794d6bfcf82bb

James Mattis   commited 2022-05-17 07:43:33 -07:00
105962ed14
Merge "Add CTS for verifying non-ASCII characters on NsdService"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-17 06:51:46 +00:00
85cc09b6b4
Add CTS for verifying non-ASCII characters on NsdService
Add an CTS test to verify that a service can still be registered
with non-ASCII characters. And the service info can be
resolved successfully.

Bug: 230698801
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: I1cb9a558988af5f1264d0ae732ab4b62c0bb8cde

paulhu   authored and   Paul Hu   commited 2022-05-17 10:27:10 +08:00
77389f1c33
Merge "Fix LinkPropertiesTest on *-user builds"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-05-16 13:00:13 +00:00
da53636d7c
Merge "Add setter/getter methods test for DscpPolicy.Builder"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-16 12:45:02 +00:00
56fc1be1df
Merge changes Idaca34fb,I2b4ca568
* changes:
  Add CtsNetTestCasesLatestSdk to presubmit
  Fix running CtsNetTestCasesLatestSdk errors on NsdManagerTest

Paul Hu   authored and   Gerrit Code Review   commited 2022-05-16 12:02:33 +00:00
2a17c5e624
Merge "Remove Ikev2VpnProfile shims usage"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-05-16 11:47:23 +00:00
8cc7a49a1e
Fix running CtsNetTestCasesLatestSdk errors on NsdManagerTest
- All tests in NsdManagerTest would be ignored when running
  CtsNetTestCasesLatestSdk on android S devices. But
  NsdManagerTest#testNsdManager is existed before android T, it
  should not be ignored on android S devices. Besides, those
  tests can only run after android T have guarded by
  ConstantsShim check. Thus, remove DevSdkIgnoreRule on
  NsdManagerTest.
- In the legacy NsdManagerTest that covers older APIs, do not use
  newer APIs that use executors, and use only older APIs instead.

Bug: 228286975
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.\
      NsdManagerTest
Change-Id: I2b4ca568e9819dc0f476f66e43072ddbcfd75a02

Paul Hu   commited 2022-05-16 15:46:07 +08:00
9e2c6a4564
Remove Ikev2VpnProfile shims usage
Remove usage of Ikev2VpnProfileShim and Ikev2VpnProfileBuilderShim.

Both were used to allow the test to build in branches that do not have T
APIs, but all downstream branches now do.

The shims would throw checked exceptions when unsupported methods were
used, not providing fallback behavior, so they can just be replaced by
direct calls in any case.

Bug: 232251248
Test: atest Ikev2VpnTest
Change-Id: I1d5418206fab9f35403eb3baf81363b1286b0b3b

Remi NGUYEN VAN   commited 2022-05-16 15:32:57 +09:00
17f3af5fd8
Run NetworkStatsManagerTest on R+ devices.
This is not strictly necessary because the NetworkStats code is
only mainlined on T+. But it is useful to run it because it
ensures that any mainline code that uses NetworkStats APIs will
not show up as uncovered in the API coverage dashboard.

The test has not changed much recently and it should not be
difficult to keep it passing on R.

Bug: 229055233
Test: test-only change
Change-Id: Icab9e7c9e6762359cbbc2d69081636e6050573d3

Lorenzo Colitti   commited 2022-05-16 08:35:00 +09:00
e8d0004996
Revert "Fix testDataMigrationUtils fail on R device"
This reverts commit cb9ad3af0e.

Reason for revert: Now the test uses JUnit4

Change-Id: Ieb67885033e0832a21ca20f0367db05f6bfa1dab

Junyu Lai   commited 2022-05-13 18:18:15 +08:00
4bbe2b0825
Add setter/getter methods test for DscpPolicy.Builder
Bug: 220029526
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Iba8b1c178f04f3044a47a30085ead0ad36c8c7c8

paulhu   commited 2022-05-13 07:17:45 +00:00
e849ea4dbe
Merge changes Ie5689ba6,I6056da19,I89f39129,I6760d579
* changes:
  Skip NetworkStatsManager CTS test before T.
  Fix testDataMigrationUtils fail on R device
  Fix testCallback fail caused by lacking of looper
  [MS84] Add CTS for data migration utils

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-12 15:07:00 +00:00
8ed131dd0b
Merge "Register service on the specified network"
Paul Hu   authored and   Gerrit Code Review   commited 2022-05-11 05:57:04 +00:00
018cf3fb46
Skip NetworkStatsManager CTS test before T.
The corresponding class was only mainlined in T so there is no
need to run this test on previous Android versions (which must
already have passed it on device ship).

To do this, switch to JUnit 4 so we can use DevSdkIgnoreRunner.
Make setUp and tearDown public (as required by JUnit 4) and move
the AppModeFull annotation to the class level to avoid repeating
it on every test method. Also switch to getting the
instrumentation the instrumentation and the context from
InstrumentationRegistry since getInstrumentation() returns null.

Bug: 204830222
Test: atest CtsNetTestCases:NetworkStatsManagerTest
Test: atest --instant CtsNetTestCasesLatestSdk:android.net.cts.NetworkStatsManagerTest (skips all tests)
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkStatsManagerTest on S device (skips all tests)
Change-Id: Ie5689ba6e7826e51c76257cf66bd8fef846376f7

Lorenzo Colitti   commited 2022-05-11 04:15:04 +00:00
22ce43b6b9
Merge changes I5eaeb415,I236f1550
* changes:
  Check carrier privilege for CBS network requests synchronously
  Allow 3p apps to request restricted networks

Paul Hu   authored and   Gerrit Code Review   commited 2022-05-10 14:38:30 +00:00
7d180e679a
Fix testDataMigrationUtils fail on R device
Since the test is using JUnit3, which doesn't support rules
or assumeTrue, the IgnoreUpTo rule does not take effect.
Replace with a return statement as short term solution to
unblock presumit.

Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkStatsManagerTest
      on R device
Bug: 219099881
  (cherry-picked from ag/16927063)
Change-Id: I6056da19324715237c6fdac0975fb89de8a04416
Merged-In: I6056da19324715237c6fdac0975fb89de8a04416

junyulai   authored and   Junyu Lai   commited 2022-05-10 19:35:20 +08:00
cb9ad3af0e
Fix testCallback fail caused by lacking of looper
For T- devices, the registerUsageCallback invocation without
a handler needs a looper from the thread that calls into
the API, which is not available in the test.

Thus, skip related checks if the sdk level is below T.

Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkStatsManagerTest#testCallback
      on R device
Bug: 218845894
  (cherry-picked from ag/16835803)
Change-Id: I89f391297e8c7108d3e790a3d2da7b373f7b4012
Merged-In: I89f391297e8c7108d3e790a3d2da7b373f7b4012

junyulai   authored and   Junyu Lai   commited 2022-05-10 19:34:58 +08:00
324bd00c3e
[MS84] Add CTS for data migration utils
This change also add minor changes to testCallback to
increase test covergage.

Test: atest CtsNetTestCases:android.net.cts.NetworkStatsManagerTest
Bug: 204830222
  (cherry-picked from ag/16826539)
Change-Id: I6760d57929f95283b355a6369fd3571b784eb331
Merged-In: I6760d57929f95283b355a6369fd3571b784eb331

junyulai   authored and   Junyu Lai   commited 2022-05-10 19:34:40 +08:00
c7fbf25b72
Allow 3p apps to request restricted networks
Since 3p apps are allowed to use restricted networks in S, they
should be allowed to request a restricted network reasonably.
Otherwise, the functionalities of 3p apps will break if they rely
on restricted networks. Thus, CS needs to allow 3p apps to
request restricted networks if 3p apps are in the allowed list.

Bug: 230509118
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I236f1550095ee2be29adbc3b28d3ac2561a8b072

Paul Hu   commited 2022-05-10 18:10:19 +08:00
8fc2a55a16
Merge "Add MainlineTestModuleController to CtsNetTestCases"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-10 03:32:52 +00:00
28fc2c6da4
Merge "Migrate compareMajorMinorVersion to common libs"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-09 13:20:52 +00:00
33f1e8a8cb
Fix LinkPropertiesTest on *-user builds
Mark CtsNetTestCases test app as debuggable to let it run correctly on
*-user build targets.

Test: atest CtsnetTestCases:LinkPropertiesTest
Bug: 229813087
Change-Id: I21435cd6cb5c43074eef95e8896c02652ffea216

Taras Antoshchuk   commited 2022-05-08 19:28:47 +02:00
afd7def6e0
Add MainlineTestModuleController to CtsNetTestCases
When the test is run in a mainline context, this allows only running it
when the relevant modules are installed.

This is a prerequisite for test suite configurations used for module
testing.

Bug: 229951035
Change-Id: Icb67905d16a6b8f3863463e8150d61bbeabbcadd
Test: mts-tradefed run mts-all

Remi NGUYEN VAN   commited 2022-05-02 07:36:16 +00:00
a848aae8e5
Migrate compareMajorMinorVersion to common libs
This is preparation for sharing version function with
EthernetTetheringTest.

- Move compareMajorMinorVersion, getVersionFromString to
  frameworks/libs/net/../testutils/DeviceInfoUtils
- Move testMajorMinorVersionCompare to
  packages/modules/NetworkStack/../testutils/DeviceInfoUtilsTest

Bug: 230359047
Test: atest \
android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimitTelephony \
android.net.cts.ConnectivityManagerTest#testSocketKeepaliveUnprivileged \
android.net.cts.ConnectivityManagerTest#testCreateTcpKeepalive \
android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimitWifi \
android.net.cts.ConnectivityManagerTest#testKeepaliveWifiUnsupported

Change-Id: I2c9ef22ce9bec6877b47a383cc4327dab7cc6416

Hungming Chen   commited 2022-04-29 13:58:37 +08:00
9a8f46fda9
Register service on the specified network
Currently, NsdManager registers services on all interfaces when
one network was specified in NsdServiceInfo. It's unexpected
behavior. The service should be only advertised on specified
network. Thus, correct the behavior on NsdService and add cts
test to verify it.

Bug: 220070737
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: Ief3bfa110bfa340c53edec561eb5376f6bd305e6

Paul Hu   commited 2022-04-28 20:55:30 +08:00
360a8e9e1b
Merge "Unicast state of existing ethernet interfaces when registering new Ethernet Listener."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-28 12:20:06 +00:00
baa5442dd9
Unicast state of existing ethernet interfaces when registering new Ethernet Listener.
When adding a listener via the addInterfaceStateListener API, the
expectation is that ethernet service calls that listener immediately
with a list of all interfaces and their respective state. However,
this doesn't work as expectation due to the EthernetManager stores
all registered listeners within one global service listener class,
the new registered listener will be invoked until the state of any
interface has changed.

Instead of storing all registered listeners within one global service
listener class, associate each new registered listener to an instance
of IEthernetServiceListener, and pass it to the EthernetService, that
will be invoked when iterating the state of all existing interfaces.

In order to avoid the scanning of all registered listeners, that would
be slow if there are lots of registered callbacks, moving the service
listener to the ListenerInfo class, where the service listener can
access the executor and listener passed from the caller naturely,
unnecessary to iterate the whole list.

Bug: 229125889
Test: atest android.net.cts.EthernetManagerTest --iterations
Change-Id: I111eba78d1066794c414ab5fb4a31258ea311413

Xiao Ma   commited 2022-04-28 18:59:44 +09:00
bb9a49cf72
Merge "Make a defensive copy when sending NetworkInfo change"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-28 09:29:27 +00:00
8eda07cff7
Make a defensive copy when sending NetworkInfo change
The issue scenario is:
- Telephony registers a network agent and calls markConnected().
- NetworkAgent set mNetworkInfo to CONNECTED and call
  queueOrSendNetworkInfo() with mNetworkInfo, but NetworkAgent
  don't actually send a message to CS yet because the agent is
  not registered.
- Telephony calls unregister because the cellular network is
  disconnected.
- NetworkAgent set mNetworkInfo to DISCONNECTED, overwriting the
  previous CONNECTED state, and then call queueOrSendNetworkInfo
  again with mNetworkInfo. Again this doesn't send any message
  because the agent is not connected.
- EVENT_AGENT_CONNECTED arrives. NetworkAgent replies all the
  messages in mPreConnectedQueue, but NetworkAgent send two
  DISCONNECTED NetworkInfos eventually.

The CONNECTED state should be sent to CS instead of latest state
DISCONNECTED. Thus, make a defensive copy when sending
NetworkInfo change to prevent state overwriting.

Without the NetworkAgent fix, the test will fail with no
onAvailable callback. Because the Network has never been martk as
CONNECTED.

Bug: 228623362
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I11681743d3ff87ff9affd0b7e766894dc5111028

Paul Hu   commited 2022-04-28 14:57:43 +08:00
0869af65b4
Merge "Disable data stall recovery for DnsResolverTest"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-27 05:18:31 +00:00
91c0bcba04
Disable data stall recovery for DnsResolverTest
DnsResolverTest#testPrivateDnsBypass is flaky due to data stall recovery
attempting to tear down and reconnect the disconnected connection.
Disable data stall recovery so the test can run without a potential race
condition due to data stall recovery.

Test: atest DnsResolverTest
Bug: 230427128
Change-Id: I3057540d1b261bd51513c568072c8252c5d6959a

Sarah Chin   commited 2022-04-26 17:35:45 -07:00
217f55f8b9
Merge "Add EthernetTestInterface to list of created interfaces"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-25 10:45:07 +00:00
79b38b491c
Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams
Bug: 223841137
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I683f6242e4ed4a469893e3a17fe7b479a7a768e5

chiachangwang   commited 2022-04-21 14:49:41 +08:00
476e2a08bf