Commit graph android_packages_modules_Co.../staticlibs/testutils
Message SHA1
Add get exclude all host IPv6 multicast addresses function to apf_utils
Test: atest NetworkStaticLibHostPythonTests
Change-Id: Ib05eaf6ac94e9511a43b4b494eb5935746f50aa7

Jimi Chen   commited 2025-03-19 13:41:41 +00:00
ceefdceafd
Remove the queue on the NetworkAgent side
Now that the system server has a queue doing this job,
the queue on the network agent side can be removed.

Test: ConnectivityCoverageTests, CtsNetTestCases
Change-Id: Idf0435f447cfdd28d829a867d1085771837c6f9b

Chalard Jean   commited 2025-03-18 19:23:57 +09:00
391ec5d99c
Merge "Collect diagnostics without storage permission" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2025-03-18 02:05:21 -07:00
899737e0e0
Merge "Add carrier privilege utils to CarrierConfigRule" into main
Quang Luong   authored and   Gerrit Code Review   commited 2025-03-17 23:35:22 -07:00
ab6342b70e
Add carrier privilege utils to CarrierConfigRule
Move the existing helper methods to acquire carrier privileges in
NetworkAgentTest.kt to CarrierConfigRule where it can be reused by other
CTS tests. Also reset the carrier service package override in the rule
cleanup.

Bug: 216524590
Test: atest NetworkAgentTest
Change-Id: Id907a2d641aa61838119e2be65654b9796464498

Quang Anh Luong   commited 2025-03-18 13:05:01 +09:00
a620310e9c
Use non-tentative IPv6 addresses in multi-device test
This update ensures multi-device offload tests retrieve only non-tentative IPv6 addresses,
preventing test caused by tentative addresses undergoing duplicate address detection.

Test: atest NetworkStaticLibHostPythonTests
Change-Id: Id2f61a34eda01a6e8e0457647229fe438a85c232

Jimi Chen   commited 2025-03-17 06:31:46 +00:00
2bfe2654d1
Merge "Add at_least_B() decorator to restrict multi-device tests to Android B+ capable device." into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-03-13 12:01:33 -07:00
d5dd81741c
Add at_least_B() decorator to restrict multi-device tests to Android B+ capable device.
Test: TH
Change-Id: Id5fde8c59560bb84bed062331121c3524f362c7b

Jimi Chen   commited 2025-03-13 14:05:09 +00:00
476552a7ae
Merge "Invoke tcpdump with -l" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2025-03-12 02:18:14 -07:00
ca91ebdcab
Merge "Use non-extended mockito for net-tests-utils" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2025-03-11 19:00:20 -07:00
ec2a5cc5c5
Invoke tcpdump with -l
Currently ConnectivityDiagnosticsCollector invokes tcpdump with -U,
which would causes the collector failed to log ending packets due to
packet buffering.

Test:
android.net.cts.TrafficStatsTest#testTrafficStatsForLocalhost
Bug: 393471251
Change-Id: Ibe2977097bdeeef9546ce9c83b1dfd695c31f6d1

Junyu Lai   commited 2025-03-10 23:41:50 -07:00
2685014bf7
Use non-extended mockito for net-tests-utils
Mockito extended tends to cause all kinds of issues due to the way it
injects itself into the bytecode of framework classes instead of
creating subclasses.

Use non-extended mockito as it is not actually necessary for current
tests.

Test: atest
Change-Id: Id2874309cce2778c4405b852df9a3ae816c4abcb

Remi NGUYEN VAN   commited 2025-03-10 17:59:19 +09:00
05c376a4c5
Merge "Use 'ip link' to prevent permission errors in non-root environments" into main
Jimi Chen   authored and   Gerrit Code Review   commited 2025-03-06 16:31:21 -08:00
a7b9afbbfa
Use 'ip link' to prevent permission errors in non-root environments
The 'ip link show' requires root permissions, causing errors.
This change replaces 'ip link show' with 'ip link'.

Bug: 401123634
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I82b219ae9179f23e3233f797aeb4aa3740e6d3ec

Jimi Chen   commited 2025-03-07 00:25:34 +00:00
c471fc945c
Merge "Revert^2 "Allow collecting diagnostics from shell commands"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-05 15:57:46 -08:00
d1713458a8
Revert^2 "Allow collecting diagnostics from shell commands"
This reverts commit 3eec0163fc.

Reason for revert: Failures in b/399299587 are flakes and not related

Original message:

Allow adding output from any shell command to the test diagnostics file,
instead of just dumpsys.

This introduces a new ShellUtil that can also help run more complex
commands, with pipes and redirects or as root for example.

Bug: 317602748 
Test: atest with tests using this util
Change-Id: I609469864dfa5d520c055b648f9cac2f4443c5c6

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2025-03-04 02:54:50 -08:00
83af0f15dd
Enable Bluetooth before running testReserveL2capNetwork
Bug: 397740298
Test: TH
Change-Id: If35a4b83ab8f96d0c98b3bf2ecb8b0e68420c4fe

Patrick Rohr   commited 2025-02-26 13:50:06 -08:00
d1cca845e2
Revert "Allow collecting diagnostics from shell commands"
This reverts commit 47b6619fa8.

Reason for revert: DroidMonitor: Potential culprit for http://b/399299587 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Id7717258b960ac18a27575fdc2b0852b42ef4e7b

Liana Kazanova (xWF)   authored and   Gerrit Code Review   commited 2025-02-26 12:20:26 -08:00
3eec0163fc
Collect diagnostics without storage permission
Use the shell to open the output file instead of FileOutputStream. This
allows test to use ConnectivityDiagnosticsCollector even if they do not
have storage permissions.

getOutputStreamViaShell is a method of the base class
BaseMetricListener.

Bug: 317602748
Test: atest
Change-Id: I127bb6711d14fdee059a31a8a3cfddc44b1d7800

Remi NGUYEN VAN   commited 2025-02-26 11:39:55 +09:00
8b555c29c3
Allow collecting diagnostics from shell commands
Allow adding output from any shell command to the test diagnostics file,
instead of just dumpsys.

This introduces a new ShellUtil that can also help run more complex
commands, with pipes and redirects or as root for example.

Bug: 317602748
Test: atest with tests using this util
Change-Id: I0a0b5c7be5afd9e592dd820bfdbcee39ade418f8

Remi NGUYEN VAN   commited 2025-02-26 11:39:51 +09:00
47b6619fa8
Reverse pollingCheck arguments to be more kotlin friendly
Test: TH
Change-Id: Ibe52ccd9eec619ced5f8b84896d2a1efc6c0fefc

Patrick Rohr   commited 2025-02-25 15:30:52 -08:00
7f9469e808
Move pollingCheck to testutils
Test: TH
Change-Id: I7d9362dcda095f8037467baf3602911fc3a3c072

Patrick Rohr   commited 2025-02-25 15:30:51 -08:00
b4809fdd08
Merge "Support Paramerized in SetFeatureFlagsRule" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-20 00:10:15 -08:00
154cfdc40e
Support Paramerized in SetFeatureFlagsRule
Make Parameterized compatible with SetFeatureFlagsRule. If both
are used, the method names seen by SetFeatureFlagsRule may
be followed by [\d+] in Parameterized style, leading to a method
not found exception in SetFeatureFlagsRule. With this patch, both
can be used at the same time.

Test: add a Parameterized rule to CaptivePortalLoginActivityTest
      see how it fails with MethodNotFoundError without this patch
      see how it works as expected with this patch
Change-Id: I3fe1e63600dd792bc290ed130b8598b49f2b95e1

Chalard Jean   commited 2025-02-20 15:46:39 +09:00
1c0939c365
Do not expect validated when connect to Wi-Fi for upstream type None
Currently, upstream network validation is always required, even
for type None. This is unnecessary for APF and mDNS tests, as
they can be executed on local networks. Additionally, some
devices lack the ability to perform network validation when the
hotspot is enabled due to hardware limitations. Therefore, remove
the validation check for upstream type None.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases:ConnectivityMultiDevicesTest
Bug: 335368434
Bug: 396551848
Change-Id: If2a96cf9d62e37fc27be6193f9ce9b9cfc8613df

Junyu Lai   authored and   Paul Hu   commited 2025-02-17 21:22:19 -08:00
d16aa5538e
Wait for carrier config to apply in tests
TetheringManagerTest#testRequestLatestEntitlementResult in particular
set carrier config overrides without waiting for the override to be
applied, which caused flakes.

Wait for the override to be applied when adding and clearing them.

This makes the logic to wait for the update in NetworkAgentTest
unnecessary.

Bug: 391966043
Test: atest
Change-Id: I371ff5742627ca0b1b6eb6be5f0fd19a0487ae83

Remi NGUYEN VAN   commited 2025-02-05 15:42:54 +09:00
b9ac4c8fe2
Merge "Revert^2 "Fix flakes due to tests resetting CarrierConfig"" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2025-01-24 03:29:10 -08:00
0e2102069e
Revert^2 "Fix flakes due to tests resetting CarrierConfig"
This reverts commit 19a936d3ab.

Reason for revert: revert^2 to verify if this CL really break TH.

Change-Id: I8600883785881d857b7e79cf16459e33080fa82b

Yuyang Huang   authored and   Gerrit Code Review   commited 2025-01-23 18:56:11 -08:00
6f99275476
Merge "Revert "Fix flakes due to tests resetting CarrierConfig"" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2025-01-23 18:55:18 -08:00
55105df5ee
Revert "Fix flakes due to tests resetting CarrierConfig"
This reverts commit c7ed1a195a.

Reason for revert: possibly fails on S

Bug: 391766151
Change-Id: I24c72b48e037c2e2b7852bcc8300de777a391557

Maciej Żenczykowski   commited 2025-01-23 15:38:01 -08:00
19a936d3ab
Merge changes Ia25b28d5,Ic6bbd8c0 into main
* changes:
  Fix flakes due to tests resetting CarrierConfig
  Fix lint errors in NetworkAgentTest

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-19 20:01:08 -08:00
4ab11df911
Fix flakes due to tests resetting CarrierConfig
Some tests use CarrierConfigManager#overrideConfig(subId, bundle) to set
some configs, and then overrideConfig(subId, null) to reset the
override.  However this also resets overrides that may have been set by
the instrumentation, such as ConnectivityTestTargetPreparer /
CarrierConfigSetupTest.

Avoid this by providing a common utility to set and tear down carrier
config, which reset the overrides to the original setting value instead
of clearing all overrides.

Test: atest
Bug: 253698734
Change-Id: Ia25b28d551b62205c52f91e0ffad1b94710c0828

Remi NGUYEN VAN   commited 2025-01-20 11:55:39 +09:00
c7ed1a195a
Add 'automotive-general-tests' to the CtsNetTestCases dependencies
This change adds missing dependancies of CtsNetTestCases to the automotive-general-tests zip

Change-Id: Iba2da89b380214ad785d504a484b0b72b508814d
BUG: 382649664 
Flag: TEST_ONLY

Filip Zakrzewski   commited 2025-01-16 15:25:33 -08:00
c4e71897a5
Merge changes Iddc8975b,I2cedd584 into main
* changes:
  Add diagnostics on failure for PrivateDns test
  Wait for default route for wifi check

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-15 00:45:15 -08:00
ba7089227f
Merge "Address lint warnings in diagnostics collector" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-15 00:13:15 -08:00
cbf9b1163e
Add diagnostics on failure for PrivateDns test
IWLAN on U 24Q2 release may cause this test to fail, but this was
supposed to be addresed by CarrierConfigSetupTest already.

Add diagnostics on failure to figure out if the IWLAN config is as
expected.

Test: atest
Bug: 253698734
Change-Id: Iddc8975bb473979f9c2769cd178ef75644b82aa7

Remi NGUYEN VAN   commited 2025-01-15 16:12:40 +09:00
4d47b52f6d
Wait for default route for wifi check
Instead of only waiting for an IPv6 address, wait for global IPv6
addresses to be routable.

This mirrors the check used for AI_ADDRCONFIG in DnsResolver. Without
this, the later call to network.getAllByName may only return IPv4
addresses if IPv6 global addresses are not reachable.

Test: atest
Change-Id: I2cedd58431eb8abeb5ffd9fb8daedb061586373b

Remi NGUYEN VAN   commited 2025-01-15 16:12:04 +09:00
ee21b71492
Address lint warnings in diagnostics collector
This change was generated by running the formatting tool.

Test: m
Change-Id: I38f5b3d0cc60c12b3a312a9e8498565f73a638f1

Remi NGUYEN VAN   commited 2025-01-15 16:05:29 +09:00
6f694d0ef9
Merge changes from topic "resolv_cancellation" into main
* changes:
  Add CTS test for DnsResolver cancellation
  Add DnsResolverTapTest

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2025-01-07 19:05:25 -08:00
26630dcd06
Return the matched event from TestableNetworkOfferCallback
Since the requestId is generated by CS, the only way to get a hold of it
is by intercepting the onNetworkNeeded() callback.

Test: TH
Change-Id: I8d66d287633151f9cfe7053c2b934121d2c96dbc

Patrick Rohr   commited 2024-12-20 15:15:28 -08:00
da8ae0edfe
Add support for testing onReserved callbacks
Test: TH
Change-Id: I0d35567dae5865cc2de9e5f6811f1b9a57a04cbd

Patrick Rohr   commited 2024-12-20 15:15:28 -08:00
fe3d77a042
Merge "Dump tcpdump on failure in testUidTagStateDetails" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-12-10 07:15:41 +00:00
75cd08977d
Merge "Reconnect to wifi if supported" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-12-05 09:30:12 +00:00
bd579b4658
Merge "Make ConnectivityTestPreparer.apk path explicit" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-12-05 08:55:46 +00:00
af139d7b7d
Reconnect to wifi if supported
Some tests may disable wifi when testing, for example,
tests which setup cellular default network.
Reconnect to wifi to prevent from flaky.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases:ConnectivityMultiDevicesTest
Bug: N/A
Change-Id: Ic0e27efc0e82698618c651c0a78b000c0ffe2131

Junyu Lai   commited 2024-12-05 08:12:25 +00:00
ad713e007a
Make ConnectivityTestPreparer.apk path explicit
Instead of using recursive search in test directories to find
ConnectivityTestPreparer.apk, only search for it in the dependencies of
net-tests-utils-host-common.

The default strategy for finding test files is to do a recursive search
in test directories, which may find wrong files in wrong directories.
In particular, if some MTS test includes the checker APK, and that test
is linked to a module that boards the train at a version different from
this target preparer, there could be a version difference between the
APK and the host-side preparer.

Follow-up changes will remove ConnectivityTestPreparer.apk from the
dependencies of each test case so it does not appear multiple times in
test suites like android-mts.zip, but this change makes the process
more deterministic.

Test: mts-tradefed run mts-dev -m CtsTetheringTest
Bug: 377716515
Change-Id: I3b00ef9a0bd1d29e8734f44413be4ff16879c574

Remi NGUYEN VAN   commited 2024-12-05 14:46:29 +09:00
4a79993944
Merge "Add mcts and mcts-tethering to net-tests-utils-host-common for the dependency of ConnectivityTestPreparer" into android15-tests-dev am: 900fb00793
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3381265

Change-Id: I92961a480281fc239dcde1d0cf0480cbbd496486
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Tongbo Liu   authored and   Automerger Merge Worker   commited 2024-12-03 03:34:40 +00:00
4f1c1ea358
Dump tcpdump on failure in testUidTagStateDetails
Add support for dumping tcpdump on test failure into the conndiag
artifact, and apply it to testUidTagStateDetails.

testUidTagStateDetails has recently been flaking due to unidentified
extra traffic, and this may help identify that traffic. Having an easy
way to collect tcpdump on test failure should help diagnose flakes going
forward as well.

Bug: 345322466
Test: atest
Change-Id: Ib2881be3df82b3b31b3a524987f775fa03279f63

Remi NGUYEN VAN   commited 2024-12-02 12:52:20 +09:00
8f265c9b43
Add mcts and mcts-tethering to net-tests-utils-host-common for the dependency of ConnectivityTestPreparer
Bug: 379792488
Change-Id: I725bc9d7fed7df23ccc21d1f4dc4fa10e0315cc9

Tongbo Liu   commited 2024-12-02 03:11:19 +00:00
17ab27e71f
Merge "Only report tryTest errors when not caught" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-12-02 01:48:40 +00:00
739a6c4320