Commit graph android_packages_modules_Co.../tests/cts
Message SHA1
Merge "Bump tethering target sdk to 33"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-06-01 08:57:46 +00:00
d10244feb8
Bump tethering target sdk to 33
Note: to avoid missing some dependeices change only happen in T+, below
testing verification is perform by internal branch.

Test: atest TetheringTests
      atest TetheringIntegrationTests
      atest CtsTetheringTest
      atest MtsTetheringLatestSdk
      manually change entitlement check recheck period to 1 min and
      monitor schedule alarm works.
      Dogfood this change personally 7 days, major use hotspot sharing network to notebook to work.
Bug: 232193147
Change-Id: I3cba98f42ac1a9c0c1db4b2ad036aff714a428f3

Mark Chien   commited 2022-05-31 03:31:18 +00:00
d25a1e05ae
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
Remove the redundant sleep after turning on the screen.
We are checking for network access in onResume(), which
wouldn't be called until the screen is on. So, there
shouldn't be a need for the extra sleep after turning
on the screen.

Also, remove redundant waits after the last try when
doing verifications as the test is anyway to going to
fail at this point.

Bug: 231440256
Test: atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
Change-Id: I28429c929142a95c19b1f8a5b7d28b9c8c4a45b9
Merged-In: I28429c929142a95c19b1f8a5b7d28b9c8c4a45b9

Sudheer Shanka   commited 2022-05-23 20:10:06 +00:00
c2edb9cbc4
Keep the screen on while the test activity is on top.
Bug: 231440256
Test: atest com.android.cts.net.HostsideConnOnActivityStartTest
Change-Id: Ibb0cc4c8a7cc2338ca938c775706f6b779fa96d3
Merged-In: Ibb0cc4c8a7cc2338ca938c775706f6b779fa96d3

Sudheer Shanka   commited 2022-05-23 20:07:54 +00:00
d1affb65da
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
Merge "Avoid unregistering the same receiver more than once."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-07 00:07:22 +00:00
e5a9ad96c5
Avoid unregistering the same receiver more than once.
Bug: 231496005
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Iba17daa70f14bdee1d1a7d32cb9dc64623ba1d24
Merged-In: Iba17daa70f14bdee1d1a7d32cb9dc64623ba1d24

Sudheer Shanka   commited 2022-05-06 22:53:39 +00:00
d1e236eb05
[LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity
Added SPDX-license-identifier-Apache-2.0 to:
  tests/cts/hostside/app3/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I0f594c539640b9815040bf5082677592574b022d

Bob Badour   commited 2022-05-05 07:11:29 -07:00
2a50c246cd
Add tests for LinkProperties#EXCLUDED_ROUTES
Add CTS tests for LinkProperties#EXCLUDED_ROUTES gated change.
These tests check LinkProperties#getRoutes and
LinkProperties#getAllRoutes behavior depending on whether the gated
change is enabled.

Bug: 186082280
Test: atest HostsideLinkPropertiesGatingTests
Change-Id: Id353714331a19d09022d20f186c8f71343686da7

Taras Antoshchuk   commited 2022-05-03 23:45:33 +02:00
f0c8daa0eb
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
Merge "Add test dependencies for CtsHostsideNetworkTests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-04-29 03:07:47 +00:00
5672613027