Commit graph android_packages_modules_Co.../tests
Message SHA1
Merge changes from topic "Intent spam" into main
* changes:
  Unit test for intent spam
  Fix spamming of network stats updated intent

Yun-Chen Cheng   authored and   Gerrit Code Review   commited 2024-08-12 05:14:16 +00:00
925747a773
Merge "Support NetworkStats#addEntries API" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-08-09 10:06:03 +00:00
a7511c2318
Unit test for intent spam
Add unit test to test feature
BROADCAST_NETWORK_STATS_UPDATED_RATE_LIMIT_ENABLED_FLAG.
When feature is on, broadcast message should be delivered
with the designated interval(b/343844995),
When feature is off, each message should be delivered
regardless of previous intent.

Test: atest FrameworksNetTests:android.net.connectivity.com.android\
	.server.net.NetworkStatsServiceTest\
	#testNetworkStatsUpdatedIntentSpam_rateLimitOn
Test: atest FrameworksNetTests:android.net.connectivity.com.android\
	.server.net.NetworkStatsServiceTest\
	#testNetworkStatsUpdatedIntentSpam_rateLimitOff
Bug: 343844995
Change-Id: I4b89497c336a310c6959db579ca9ae3c572ff70c

Yun-Chen Cheng   commited 2024-08-09 08:38:30 +00:00
fecc2ec193
Support NetworkStats#addEntries API
Currently, NetworkStats#addEntry creates a new instance
containing the requested result instead of mutating the
original object. This creates a heavy memory footprint
when the caller invokes it in a loop because a new NetworkStats
instance is created whenever an addEntry is called.

This change introduces a new API that allows callers to
add a set of entries to a NetworkStats instance. This new
API will clone the instance only once, return the newly
created (and modified) instance, and ensure that the original
instance remains immutable.

Additionally, the change adopts config libraries for flagging
the API and corresponding CTS tests, since Android U-based
branches are no longer downstream of current development branches.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.netstats.NetworkStatsApiTest
Test: atest CtsNetTestCases:NetworkStatsApiTest
Bug: 335680025
Fix: 357772271
API-Coverage-Bug: 357772271
Change-Id: I58513844e681c0621a6107ec4b198cd3957f289d

Junyu Lai   commited 2024-08-09 14:19:38 +08:00
d0e049455c
Merge "Use ensureCellularValidated which request cell" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-09 04:45:30 +00:00
2fc3231b5c
Use ensureCellularValidated which request cell
ensureValidatedNetwork does not request network.
So this fails if MOBILE_DATA_ALWAYS_ON is disabled and the cell network
is down

Bug: 356291552
Test: ConnectivityManagerTest
Change-Id: I0e5f67467d6ef591028225ddb138d8ed5f4fa32a

Motomu Utsumi   commited 2024-08-07 10:02:51 +00:00
5443938a41
Skip adding ingress discard rule to OEM VPN
OEM VPNs might need to receive packets to VPN address via
non-VPN interface.

Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Ia9000bcbb5b3b9e1e0d396ba78946be36e2fc5ba

Motomu Utsumi   commited 2024-08-06 19:02:33 +09:00
c14288f7c7
Merge changes If787d3f3,I6de357ac into main
* changes:
  Rename getShrinkedBackingArray to getMinimized*
  Suspend callbacks for frozen apps

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-08-05 00:15:39 +00:00
057369c840
Merge "Skip adding ingress discard rule to legacy VPN" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-02 23:44:47 +00:00
c4b4feed19
Merge "Add removeServices method in MdnsServiceCache" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-08-02 12:46:54 +00:00
73889ed954
Add removeServices method in MdnsServiceCache
This method can remove all services that match the given
CacheKey.

Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I83e1a0cbdd4355d92510b5f9a550f96ef0154682

Paul Hu   commited 2024-08-02 11:32:12 +00:00
d90f31884b
Rename getShrinkedBackingArray to getMinimized*
"Shrinked" should actually be "shrunk" or "shrunken"; in any case
"minimized" is simpler and possibly more accurate (it's the minimum size
required to hold the values).

Test: atest
Change-Id: If787d3f3d6e1046338d4e89ed924bce183e74bd6

Remi NGUYEN VAN   commited 2024-08-02 19:27:41 +09:00
dfb159289b
Suspend callbacks for frozen apps
To avoid filling the binder buffers, and sending unnecessary callbacks
when apps are unfrozen (for example successive LinkProperties changes or
onAvailable+onLost are not useful), queue and aggregate callbacks for
apps that are suspended.

Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I6de357ac2834f1f7e960dfbaa63adfc3825f2a82

Remi NGUYEN VAN   commited 2024-08-02 19:24:17 +09:00
2d78124348
Skip adding ingress discard rule to legacy VPN
Some legacy VPNs need to receive packets to VPN address via
non-VPN interface.

Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Iad06dc69c5bf5ccda476e89ed9b0fc1bc63d2ebe

Motomu Utsumi   commited 2024-08-02 19:15:59 +09:00
1b376f0fc4
Merge "Fix ktlint errors" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-02 08:40:23 +00:00
c759b039ac
Move TapPacketReader into EthernetTestInterface
Test: atest NsdManagerDownstreamTetheringTest
Change-Id: I7a13f8a6d362429c0f59cb9bbffe4a6a59048537

Patrick Rohr   commited 2024-08-01 22:49:26 +00:00
d0d2cb32a9
Refactor Drop EtherCat packet test
This is a no-op refactoring, which is preparation for follow-up
changes to add more apf tests.

This includes:
1. Add a method to send packet and expect counter increases.
2. Inline the packet construction code in the test method.

Test: atest NetworkStaticLibHostPythonTests
Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases
Bug: 350880989
Change-Id: Iadcfd97740033306af1b6a474004cbf0699ddd1b

Junyu Lai   commited 2024-08-01 03:32:19 +00:00
6f6b1a4684
Refactor ApfV4Test
This is a no-op refactoring, which is preparation for follow-up
changes to add more apf test classes.

This includes:
1. Move initialization code to a base class, which setup a hotspot
   and a client connects to it, and enable doze mode to
   activate the apf.
2. Check whether send raw packet is supported before testing.

Test: m connectivity_multi_devices_snippet && \
  atest CtsConnectivityMultiDevicesTestCases
Test: atest NetworkStaticLibHostPythonTests
Bug: 350880989
Change-Id: I6376935883653182728e473e2f5533407d993d7b

Junyu Lai   commited 2024-08-01 03:32:19 +00:00
cf655869ba
Move apf test to a standalone file
This is a no-op refactoring, which is preparation for follow-up
changes to add more apfv4 tests.

This includes:
  1. Add a entry point for multi-device tests to collect
     test cases from different files.
  2. Move multi-device initialization code to a base class.
  3. Make different test classes inherit the base class.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases
Bug: 350880989
Change-Id: I294c85d8e09633bbf02ba1543b9f2ea3e988e20d

Junyu Lai   commited 2024-08-01 03:32:19 +00:00
32a2d151cc
Merge "Mark cleanedUp volatile since finalizer runs on any thread" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-01 03:00:04 +00:00
e90f1d7bc4
Merge changes I0be59107,Iaf5f3f9b into main
* changes:
  Also run NetworkValidationTest when FEATURE_USB_HOST is present
  Use AutoCloseTestInterfaceRule in NetworkValidationTest

Patrick Rohr   authored and   Gerrit Code Review   commited 2024-08-01 02:02:45 +00:00
f116ee1627
Mark cleanedUp volatile since finalizer runs on any thread
Change-Id: I08128fcc3ffdfb7abd3d31efad9e5d7bc2b0c87f
Test: test only change

Patrick Rohr   commited 2024-08-01 02:01:38 +00:00
e2b447035e
Merge "Fix dependencies on connectivity_native lib" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-01 00:20:48 +00:00
f119dcff1f
Merge changes I44e85c09,I01810b54,I1c169311,I15f2aeac,I048512a1 into main
* changes:
  Use AutoCloseTestInterfaceRule in NsdManagerDownstreamTetheringTest
  Add auto close rule for test interfaces
  Add finalizer to check whether destroy was called
  Wrap use of test interface in EthernetTestInterface
  Add a class to properly manage ethernet test interfaces

Patrick Rohr   authored and   Gerrit Code Review   commited 2024-07-31 20:36:45 +00:00
74e3f5aa48
Also run NetworkValidationTest when FEATURE_USB_HOST is present
Checking for the existence of ethernet service should be enough.
Ethernet service is also running when there is USB host support.

Test: atest NetworkValidationTest
Change-Id: I0be59107642704d9aeeb1e08d705d1d66dbf72d1

Patrick Rohr   commited 2024-07-31 17:53:33 +00:00
9ab7e4a4d0
Use AutoCloseTestInterfaceRule in NetworkValidationTest
This change also removes the DevSdkIgnoreRule since mainline no longer
ships to devices running Q.

Test: atest NetworkValidationTest
Change-Id: Iaf5f3f9b53b78b91719dfc8d466ca1fa80f9bd21

Patrick Rohr   commited 2024-07-31 17:53:24 +00:00
f75b3ffcad
Use AutoCloseTestInterfaceRule in NsdManagerDownstreamTetheringTest
Test: atest NsdManagerDownstreamTetheringTest
Change-Id: I44e85c09f1ebf6bd698905fc0d349a6405747288

Patrick Rohr   commited 2024-07-31 17:52:17 +00:00
4f11942dcb
Merge "Do not send empty TXT records" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-07-31 08:54:14 +00:00
141aac3b73
Merge "Fix to return BLOCKED_REASON_NONE for system uids" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-31 07:49:32 +00:00
1e29da75e9
Fix ktlint errors
Obtained with:
    prebuilts/ktlint/ktlint.py --format --no-verify-format --file FILE

--no-verify-format is used to ignore checks that are performed by ktfmt
(see ktlint.py).

Test: m
Change-Id: Ief2c146833e43492d0333b05f1c2b67bbfbc16e0

Remi NGUYEN VAN   commited 2024-07-31 12:01:08 +09:00
89b87e143d
Do not send empty TXT records
Empty TXT records should not be sent when advertising as per RFC 6763
6.1, although it also specifies that in case they are sent, they must be
treated the same as TXT records with an empty String.

Some recent discovery implementations seem to not be able to find
services that send empty TXT records; ensure MdnsAdvertiser sends TXT
records with an empty attribute instead.

Test: atest
Bug: 351250155
Change-Id: If928e5f7c371faa456535160f10880adb1449b92

Remi NGUYEN VAN   commited 2024-07-31 12:01:05 +09:00
9ecc57021b
Fix dependencies on connectivity_native lib
Address the TODO to link against the library directly, and add necessary
test filters to only run the test on the primary ABI (because the
library in the apex has only one variant for primary ABI), and to only
run the test on U+.

Bug: 356022894
Test: atest
Change-Id: Ib52bfc1051059aaf9d14d1f7707864206d0bdcd9

Remi NGUYEN VAN   commited 2024-07-31 00:39:50 +00:00
fba7850552
Fix to return BLOCKED_REASON_NONE for system uids
Bug: 289439578
Test: BpfNetMapsTest
Change-Id: Ib50c2755bc8642cc0dc4e95384d35e38be400a2c

Motomu Utsumi   commited 2024-07-30 16:56:52 +09:00
29c0d2aea7
Fix testIkeOverUdpEncapSocket flakiness caused by cached ifaceStats
Since the target SDK of this test should always equal or be
larger than V, TrafficStats caching is always enabled.
Clearing the cache is needed to avoid rate-limiting on
devices with a mainlined (T+) NetworkStatsService.

Test: atest CtsNetTestCases:android.net.cts.IpSecManagerTest#testIkeOverUdpEncapSocket \
      --rerun-until-failure 100 (on T device with latest tethering module)
Fix: 355530686
Change-Id: I9c61b72c78262445632fa7c9a2ce17491b52481d

Junyu Lai   commited 2024-07-30 13:40:52 +08:00
a75c11c07b
Merge "Moving NPMS related tests to cts" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-26 17:51:33 +00:00
cc2877cfb7
Skip the unnecessary attempt to retrieve the server side dynamic config for ConnectivityManagerTest.
The test doesn't have server side dynamic configs.

Test: local runs
Bug: 317166695
Change-Id: I8cfbded9992799cbdd2ce996fb21aa408a072876

zhi   commited 2024-07-26 09:58:05 +08:00
93b3d29a89
Moving NPMS related tests to cts
Developing these tests from within this project causes a lot of
maintenance toil because they are not applicable to the code in the
module. Moving them to be in the cts repo where they're on the same
development cycle as the code they test.

The tests are being moved from tests/cts/hostside-network-policy to
hostsidetests/network-policy to be consistent with the destination
repository's naming conventions.

Test: atest CtsHostsideNetworkPolicyTests

Bug: 322115994
Change-Id: I53bb4a25ef8f3229e8cf5024c59f4f1aa8c63cce

Suprabh Shukla   commited 2024-07-26 01:26:22 +00:00
251d208634
Merge "Add post-update program verification to ApfIntegrationTest" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-07-23 18:04:38 +00:00
4059c1ccab
Merge "Clear all APF memory in testDropPingReply() in preparing stage" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-07-23 17:56:13 +00:00
88dc9c06f6
Add post-update program verification to ApfIntegrationTest
Refactored ApfIntegrationTest to include a verification step after each
program update, ensuring correct installation and improving error
detection.

Bug: 353871015
Test: TH
Change-Id: I9652725241244dbdfa6c6482ffb3d0302cd1978a

Yuyang Huang   commited 2024-07-23 20:05:44 +09:00
2717fd8983
Clear all APF memory in testDropPingReply() in preparing stage
Modified testDropPingReply() to clear the entire APF memory instead of
only the first byte.  This addresses a known firmware issue with
handling programs smaller than 8 bytes.

Bug: 339147921
Test: TH
Change-Id: I651dae8c9daac24b195196c03b54e69a757de8a7

Yuyang Huang   commited 2024-07-23 19:07:18 +09:00
e749694eb4
Add finalizer to check whether destroy was called
Logs wtf if destroy() was not called.

Test: atest NsdManagerDownstreamTetheringTest
Change-Id: I1c1693113c4ce4be8121a5af1bd4b7082eec15a3

Patrick Rohr   commited 2024-07-22 12:05:57 -07:00
d427ead01c
Wrap use of test interface in EthernetTestInterface
NsdManagerDownstreamTetheringTest closed the test interface without
waiting on the STATE_ABSENT callback from ethernet service. This meant
that during setUp, an ethernet test interface might
still have been present from the previous test causing the test to be
flaky.

Note that flakiness was not uncovered until a recent change in
EthernetTetheringTestBase, which skips tests when a built-in ethernet
interface is present. This check used to throw an assumption failure if
any interface for tethering was already available, but was recently
changed to only throw the assumption failure if said interface is not
named testtap%d. So this test has always been broken, it just was not
obvious because the flakes would result in the test getting skipped.

Test: atest NsdManagerDownstreamTetheringTest --iterations 20
Bug: 348064142
Change-Id: I15f2aeacdf621a4413bda032331abb64c75d86a7

Patrick Rohr   commited 2024-07-22 12:05:57 -07:00
a255cbacf2
Add a class to properly manage ethernet test interfaces
Tun/tap interfaces are difficult to use in combination with
EthernetManager#setIncludeTestInterfaces(). For one, the test must
ensure that the ethernet service has fully unregistered the interface
before calling setIncludeTestInterfaces(false) at the end of the test.
Otherwise, test setup of the next test might race with interface tear
down processing.

In order to make the correct use of tun/tap interfaces in ethernet
service easier, this class encapsulates the appropriate calls to
setIncludeTestInterfaces() and synchronizes interface creation and
deletion with processing in ethernet service by listening to the
respective callbacks.

Note that tests that do not register their interfaces with ethernet
service could technically still race with tests that do, though setUp()
unlikely to win.

Test: mm
Change-Id: I048512a1e4eef17a6f02d46b8b9f7a16210e3271

Patrick Rohr   commited 2024-07-22 12:05:57 -07:00
b3c1062088
Merge "Update the QueryTaskConfig constructor" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-07-22 02:02:31 +00:00
6ade6e2042
Merge "Use compile_multilib: "both" for MTS" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-19 18:12:17 +00:00
78931a3c91
Use compile_multilib: "both" for MTS
Ensure MTS modules are compiled with both 32 and 64 bit ABI, as MTS
attempts to run both.

Recent changes have started failing tests when one of the ABI is
missing, see change ID: I5310ca67879534cb066dcedf6a9102a39e085faf

Test: atest bpf_existence_test -- --abi armeabi-v7a
Fixes: 352592958
Fixes: 354070942
Change-Id: Iea494323ccc12710bff6d488f2b51b13255d841e

Remi NGUYEN VAN   commited 2024-07-19 19:26:15 +09:00
e93822153f
Merge "@RestoreDefaultNetwork in ConnectivityManagerTest" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-07-18 09:27:01 +00:00
97963d4f65
Update the QueryTaskConfig constructor
This is a no-op refactor. Move some parameters from
QueryTaskConfig to QueryTask, or bring them from public methods.

Bug: 345146854
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I47d420842c4f9cec3fe25b5e2febc84a1e495f40

Paul Hu   commited 2024-07-18 06:16:57 +00:00
8c5dc514bf
Merge "Consolidate DNS label comparison functions in DnsUtils" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-18 04:50:45 +00:00
880807031f