Commit graph android_packages_modules_Co.../staticlibs/tests/unit/Android.bp
Message SHA1
Enhance TimerFileDescriptor to schedule multiple tasks
Improved the class to allow scheduling and execution of multiple tasks
concurrently.

Test: TH
Change-Id: I79b63c6846e0e0a934f257d4a38d9cab08bd13e8

Yuyang Huang   commited 2025-01-09 19:38:35 +09:00
4d46630219
Build the timerfd wrapper class
Build a wrapper class that allows users to easily use the timerfd
object and trigger delayed callbacks through this class.

Bug: 366373064
Test: atest NetworkStaticLibTests
Change-Id: I8081d29e4874df8b9e59f7fc845b20cbd29aec40

Paul Hu   commited 2024-12-04 08:32:59 +00:00
50c14402f6
Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a

Jihoon Kang   commited 2024-09-10 00:01:31 +00:00
8401b6a9f0
Import absl-py library from codebase
This removes the need of pip install absl-py and
virtual env usage from the tests.

Test: atest NetworkStaticLibHostPythonTests
Bug: N/A
Change-Id: I2259f7702ecc6b5e7b7b23e2bf44fa28a5a2e07b

Junyu Lai   commited 2024-08-23 21:11:30 +08:00
f84b9074e0
Refactor RoutingCoordinator
- This CL puts RoutingCoordinator into staticlibs to make it usable by
both Tethering and ConnectivityService on R.
- This CL also changes the return type of
  ConnectivityInternalApi#getRoutingCoordinatorManager() to IBinder so
  it has fewer dependencies.

Bug: 350699020
Test: CI

Change-Id: Iba096e940795cd33e61c5141721394ad39e5ce6d

Handa Wang   commited 2024-07-05 05:26:54 +00:00
8f2c30664d
Support VirtualEnv and parameterized tests
This commit introduces the use of VirtualEnv to manage test
dependencies. Specifically:
  1. `PythonVirtualenvPreparer` is invoked before running tests
     to set up the isolated Python environment.
  2. The test is declared as a `MoblyBinaryHostTest` to enable
     VirtualEnv compatibility, as `PythonBinaryHostTest` lacks
     this support.
  3. The Mobly test runner is invoked manually to accommodate
     multiple test classes, which is not supported by
     `mobly.test_runner.main()`.
  4. Test classes are refactored to inherit from
     `mobly.BaseTestClass` for compatibility with the Mobly
     test runner.

This change is a prerequisite for subsequent commits that will
install libraries via `pip install`, facilitating isolated
dependency management for improved test reliability and
maintainability.

Also, this commit uses parameterized annotation from absl
to rewrite several tests as paremeterized tests.

Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Iffa2f8fa81c3913f3e08cca01b2c009ca959db73

Junyu Lai   commited 2024-07-03 02:02:40 +00:00
3085caaac0
Merge "Add assert_utils for multidevice test" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 05:42:09 +00:00
68c8702570
Add assert_utils for multidevice test
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: I2a9ee97b84cb16791c0c5e3cb03120e67ffeb0af

Junyu Lai   commited 2024-07-01 12:23:59 +08:00
850e6fae54
Revert "Prepare for @RequiresApi class retention"
This reverts commit 53da9ac34c.
And fixes the linter errors.

Bug: 328190227
Test: TH
Change-Id: I92e0f268c770b6e46bdc781d4867f1e0b505d4ad

Motomu Utsumi   commited 2024-06-26 19:14:30 +09:00
a1a0034f0e
Separate Struct.java into its own lib.
* Struct.java is removed from net-utils-device-common-bpf and
  net-utils-device-common-struct's source list
* Created a lib net-utils-device-common-struct-base for Struct.java
* Updated libs that require Struct.java to include
  net-utils-device-common-struct-base.
* Replaced net-utils-multicast-forwarding-structs with
  net-utils-device-common-struct in service-connectivity

Bug: 323503345

Test: build tethering module.
Change-Id: I3f60715c3d8043b7569db7612dee9d4fa1ccba59

Yang Sun   commited 2024-03-27 20:15:17 +08:00
3aa62e6773
Prepare for @RequiresApi class retention
The android framework has android.annotation.RequiresApi, which is a
copy of androidx.annotation.RequiresApi. However it was added with
source retention instead of class retention like androidx's version
has. This causes it to be missed if you compiled a library and then
used that library to compile something else, that library's public
methods won't have @RequiresApi on them when using that library's
compiled jar file.

To make @RequiresApi have class retention, we need to baseline the
NewApi issues that it would cause. These baselines also require
us to disable strict_updatability_linting in some places.

Bug: 323366771
Test: m lint-check
Change-Id: I0c984e3ba39e357ce102be442568f2d77a4f9034

Cole Faust   commited 2024-02-02 12:04:05 -08:00
53da9ac34c
[DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2
Mark NetworkStaticLibTestsLib as test for lint
This can avoid VisibleForTesting warnings in tests.

Test: atest NetworkStaticLibTests
Change-Id: If6abc33cf266246aeac22ff4b53cfba386c8979f

Yang Sun   commited 2023-12-06 19:57:29 +08:00
d5c0276b34
bump min_sdk_version from 29 (Q) to 30 (R)
Mainline no longer supports Q.
These files were recently moved into p/m/C as part of a refactor.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0f06ace921db6c79d63c0048bdb73d167ff606cf

Maciej Żenczykowski   commited 2023-09-19 23:22:58 +00:00
127a1441c3
Remove truth lib denpendency temporarily due to code coverage regression.
Bug: 291341416
Test: atest NetworkStaticLibTests
Change-Id: Id8fac2ff76dab174761fbc48d0599bcce81918ed

Xiao Ma   commited 2023-07-27 12:12:41 +09:00
9e9bc97317
Improve testBasicWorkingGetAddrQuery by checking the specific IPv4/v6 address.
Parse the entire RTM_NEWADDR message instead of only parsing the nlmsg
header and Ifaddr header. Besides, that would be better to know which IP
address will be returned from kernel via netlink message, that's IPv4
and IPv6 loopback addresses.

Test: atest NetworkStaticLibTests
Change-Id: I3a01137db4a7774fa30ebdec5a1711697991b9fe

Xiao Ma   commited 2023-07-12 13:32:19 +09:00
da97a39255
Add async BufferedFile and StreamingPacketFile impls
Bug: 245971639

Change-Id: Ief1719262c2cb68819f6feb955e97793f3638ec0

Igor Chernyshev   commited 2023-04-17 21:26:58 +00:00
810be2b456
Add wear tethering util classes
Bug: 245971639

Change-Id: I97655ece334ca93743896e89e12f8501f4e24776

Igor Chernyshev   commited 2023-01-03 06:55:23 +00:00
a25f1091c5
Enable strict_updatability_linting in frameworks/libs/net
Enable the strict_updatability_linting here first as a prior
commit to enable strict_updatability_linting in connectivity
modules.

Bug: 188851968
Test: m lint-check ; atest NetworkStaticLibTests
Change-Id: Idac98a1c85bf5bb86269b1daad2b444cfb58db8a

Chiachang Wang   commited 2021-11-19 15:41:27 +08:00
7068c88921
Separate bpf and struct util from netlink util library
1. Separate bpf and struct libraries from netlink library.
2. Rename bpfmap jni library to respect its java side library.
3. Add README to explain the rules of adding shared jni library.
4. Also allow packages/modules/Connectivity to use bpf library.

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests
      atest ConnectivityCoverageTests
Change-Id: I6e668818bede63b241cd901c0967f401613ddaf6

markchien   commited 2021-11-11 18:50:53 +08:00
f3448f905a
Move static utils to the static library
These classes used to live as a static utility in the
NetworkStack module, but that's not the right place for
them.

The point of this patch is to *not* require topics, as
any change in this space will very quickly spin out of
control and become unmanageable. As such, this starts
with creating equivalent classes in a single, easier to
manage change. Followup changes will migrate users of
the old classes to use these ones instead. Finally, the
old classes can be removed. This way, work can be
broken down into separate changes and be checked in
little by little, rather than one huge topic with many
changes doing everything in one go, which is unlikely
to be manageable.

There are no code changes from the originals, but a
number of reorganizations, most of them unavoidable.

• Vertical spacing (these classes fix it)
• Package names/imports are adjusted
• Added @hide on NetlinkMonitor
• Move all contents of RouteUtils to NetdUtils, because
  all methods depend on INetd, and some of the targets
  do not/cannot depend on netd-client
• Restrict the files used by the filegroup
  net-utils-framework-wifi-common-srcs, since that
  target does not necessarily provide all dependencies
  to all its users.
• Don't move NetworkMonitorUtils, since it depends on
  SdkLevel, and net-utils-framework-common-srcs is
  using **/*.java. It would have been possible to list
  explicitly all files actually necessary in this
  filegroup, but NetworkMonitorUtils is actually only
  used by the networking modules and not the framework.
  Eventually it should move but it doesn't have to
  be in this patch, which is complicated enough as
  it is.
• RouteUtils is now empty, because some new methods
  will be added to it soon and it is less expensive
  to keep it empty than to remove it now and add it
  again later.
• Merge NetdUtils, and unify the constants.
Some changes to satisfy checkstyle :
• Remove unused imports
• Reorder modifiers in InterfaceController
• Remove {} in IpNetworkMonitor
• Remove redundant public modifier in IpNetworkMonitor
• Add javadoc to a few methods
• Add whitespace around | in InterfaceParams
However, don't rename members in IpNeighborMonitor
like checkstyle would prefer because this would make
migration to this more involved.

Test: NetworkStaticLibsTests NetdStaticLibTests
Change-Id: I439121cba5d7ea95aa4d6c80ea25207c316880a0

Chalard Jean   commited 2021-10-27 20:08:05 +09:00
b61091b30b
Merge "Add visibility for Connectivity tests" am: bc87949c28 am: 52caed91c9
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1730122

Change-Id: I64559e2ebf6eb3307512561efbedf2fbc3ede9f8

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-21 13:56:37 +00:00
0d87cfd03f
Add visibility for Connectivity tests
Allow all Connectivity test subpackages to use the targets,
so that the visibility does not need to be updated when test suites
are reorganized inside Connectivity.

Bug: 187935317
Test: m
Change-Id: I99d1ec954ebe313e553443a9f081d54d7a5f12c1

Remi NGUYEN VAN   commited 2021-06-09 18:00:43 +09:00
f96e020879
Allow hidden connectivity APIs in net test utils
The net test utils are used for unit tests exercising connectivity code,
and need access to its hidden APIs.

Bug: 182859030
Test: atest NetworkStaticLibTests
Ignore-AOSP-First: needs manual cherry-picks
Change-Id: I33273e5c1cc2731443f0fd745ce526473a704520

Remi NGUYEN VAN   commited 2021-04-01 06:39:46 +00:00
2202e61492
Move LocationPermissionChecker to libs/net
LocationPermissionChecker was written to be used by multiple
connectivity modules, so it belongs in the frameworks/libs/net library.

The file is moved as-is with minor modifications in the test to avoid
usage of the privileged ActivityManager.getCurrentUser API.

Bug: 181837977
Test: atest NetworkStaticLibTests
Change-Id: I80cff14c06c3cab3e8f3bd1978c2951c4a3317c6

Remi NGUYEN VAN   commited 2021-03-11 20:08:06 +09:00
59beee8742
[LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net
Added SPDX-license-identifier-Apache-2.0 to:
  client-libs/Android.bp
  client-libs/tests/unit/Android.bp
  common/Android.bp
  common/native/bpf_syscall_wrappers/Android.bp
  common/native/netjniutils/Android.bp
  common/tests/unit/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: I2d4abaee12c1f20c39a7e2c9e02e2fccb96fa3ee
Merged-in: I6942c6844c89048f785f2b6eaa4bb33a24fa6f93

Bob Badour   commited 2021-02-17 17:22:02 -08:00
1b8c744bcd
Split NetworkStackUtils to frameworks/libs/net
Split DeviceConfig and collections-related utilities to CollectionUtils
and DeviceConfigUtils in frameworks/libs/net.

Also add implementations for contains(array, value), to avoid usage of
internal non-API utils.

The original tests are based on mockito-extended, so also add to
NetworkStackTests as a dependency. This also requires setting the test
app as debuggable in its manifest.

Bug: 17454103
Test: atest NetworkStaticLibTests
Change-Id: Ie9bed66a08b7370ebe50d0a7240b788f8b31aa77

Remi NGUYEN VAN   commited 2020-12-25 16:23:25 +09:00
b86b34da48
Move util classes to their destination package
Test: FrameworksWifiTests FrameworksNetTests
Change-Id: I93e9cfd968e08f983e3fd9f7196c455c79a0f32d
Merged-In: Id19c650246a8f3d55d7b6a874840a6eebcd9eb17

Chalard Jean   commited 2020-12-16 08:50:20 +09:00
ceaf7d0edc
Add visibility rules for packages/modules/Connectivity/Tethering
BUG: 167962976
Test: TH
Change-Id: I4f9c63d27fe7f10534e89f3d132f26b2f45e7b07

Baligh Uddin   commited 2020-10-29 03:57:51 +00:00
ae4770df38
Move jarjar rules from NetworkStaticTestsLib to NetworkStaticTests
jarjar should be applied on the final artifact (android_test,
android_app, java_library that goes into an apex), not on any
intermediate (android_library etc).

Bug: 171670016
Test: atest NetworkStaticTests
      atest TetheringCoverageTests
      atest NetworkCoverageTests
Change-Id: I86a15133112c555e08275efbde99e68315aa6bc2

markchien   authored and   Mark Chien   commited 2020-10-26 09:52:13 +00:00
c064abd0db
Move utilities to libs/net
These files used to be in the network stack directory, but the libs
directory is a much more suitable place for them.

Also fix a typo : ConcurrentIntepreter → ConcurrentInterpreter

Also move {FdEvents,Packet}Reader to internal annotations. That's
what they should have been using in the first place anyway.

Note that this does not fix preupload issues reported by
checkstyle to make review easier. The fixes are in a followup
patch to this one.

Test: checkbuild
Change-Id: I675077fd42cbb092c0e6bd56571f2fc022e582fd

Chalard Jean   commited 2020-07-30 22:10:51 +09:00
48c6c7d838
Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
(clean cherry-pick from internal branch)
Merged-In: I2b3dcf2e238be047147232769602df56894dc6b1

Change-Id: I2b3dcf2e238be047147232769602df56894dc6b1

Remi NGUYEN VAN   commited 2020-06-30 19:19:52 +09:00
f109837101
Make NetworkStaticLibTests as test lib
Share the tests with TetheringCoverageTests because
tethering module use net-utils-framework-common.

Remove unused static library. Currently we do not implement any
unit test for net-utils-services-common. "net-utils-services-common"
can be back when we add new test for it.

Bug: 148636687
Test: atest NetworkStaticLibTests
      atest TetheringCoverageTests
Change-Id: I2f3a94b2ba50cd4d73303961bf1661a3091ab033

markchien   authored and   Mark Chien   commited 2020-04-22 03:04:37 +00:00
ba972ca71f
Run NetworkStaticLibTests on the actual source files.
Currently, NetworkStaticLibTests tests the class files that are
on the bootclasspath of the device. This makes running these
tests slow and/or confusing, because the framework must be
rebuilt and the device flashed before running the tests, and if
this is not done, the old code will be tested instead.

Instead, jarjar the tests so the test can be run without updating
the device.

Bug: 142892223
Test: atest NetworkStaticLibTests passes on device that does not have the library
Change-Id: I6a0dbebddbd0b64e2722078345ffe6b0c0a1801e

Lorenzo Colitti   commited 2020-01-21 15:52:34 +09:00
5d9f8ed872
Add a new static library for mainline modules
Add a network static library for common utilities. This
library could be used by all mainline modules. Initially
create LinkPropertiesUtils and MacAddressUtils.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: build lib pass
      atest NetworkStaticLibTests
Change-Id: I8f79e4f836819ac83007acffb55103e5d69873e0

Aaron Huang   commited 2020-01-13 00:43:22 +08:00
f73ff8cfce