This change only outputs thread count differences instead of
listing all threads. Additionally, it ignores threads with 1
count, which effectively filter out threads created
by the test runner or other system components, such as
hwuiTask*, queued-work-looper, SurfaceSyncGroupTimer,
RenderThread, and Time-limited test.
Sample Output:
[1122/3060] android.net.connectivity.com.android.server.CSLocalAgentCreationTests#ThreadLeakMonitor: FAILED (1ms)
STACKTRACE:
java.lang.IllegalStateException: Unexpected thread changes: removed=[] added=[] updated=[TestAlarmManager=25,CSTestHandler=25]
Test: atest ConnectivityCoverageTests
(with shouldThreadLeakFailTest set to true)
Bug: 310581973
Bug: 307693729
Change-Id: I085799ebbd69c29f833335684de208105302e012
A helper class to *read* java BpfMaps. This is designed to
provide direct bpf access in the caller process through
ConnectivityManager APIs.
The change also removes any statical link to
net-utils-device-common-struct from service-connectivity.
This is because net-utils-device-common-struct is already
included in framework-connectivity. Including it again in
service-connectivity would create a r8 build fail by circular
dependency.
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.StructTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Bug: 297836825
Change-Id: I7a6d2eb816d0dc7343167bddd672806b199f44fe
Tests are sometimes run on hardware devices with wrongly configured wifi
or cell data. Ensure that this is reported as an infra error, and not a
test error, so the root cause is easier to identify.
Bug: 264170054
Test: atest
Change-Id: I4f964fbd4ee497e8ac92f7729375b75b6c4594a3
eventuallyExpect methods should print the received callbacks since
poll() was called for better debugging.
Test: atest EthernetManagerTest
Change-Id: Ia08abf2436b050a7e319b9f70694ce3d132b4fc3
UnboundedSdkLevel stopped working on Q as it now depends on Set.of,
which is an R+ API. Arguably this should be fixed as its minSdk is still
29, but long-term UnboundedSdkLevel may drop Q support as modules now
only need to support R+.
Avoid using UnboundedSdkLevel on Q- in DevSdkIgnoreRule: this avoids the
above problem, and also makes it compatible with even older builds,
which may happen in GTS.
Bug: 292868272
Test: all tests using this rule
Change-Id: I5e1559d841398a6c6763283f32c9f766a3661e21
Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.
Bug: 294110802
Test: builds
Change-Id: I2a2c91188b64619fca190a9bd7812d32f9610abd
The exception is thrown in some normal cases e.g. interrupt()
called when Os.read is blocked and waiting for the input.
Ignore such events.
Test: 1. atest NetworkStackCoverageMtsConfigTests on S device
2. atest com.android.cts.net.HostsideVpnTests
3. atest NetworkStatsIntegrationTest
Bug: 259632210
Change-Id: Ibff41312d9c7431c2b19f780844ab3a81b48f9e8
In order to return values from functions that are run on the handler
thread, use a ThrowingSupplier instead of a ThrowingRunnable.
Also maintain the case with ThrowingRunnable by overloading.
Test: NetworkStaticLibTests
Change-Id: Ic1b86f9f764997ce5d6848f04185194a961d1106
This `as? T` instruction warns that this is an unchecked cast.
It's unchecked in the literal sense : the compiler actually
doesn't check that the var is of that type. Accordingly, this
will only fail if `it` is null, which never happens.
Concretely what that means is that Java code calling this
method like
expect(AVAILABLE, network)
...will actually pass for *any* callback matching the network,
because the class is not checked.
Thankfully this code is recent and there doesn't seem to be a
lot of tests that got accepted by this bug when they should
have been rejected.
Test: ConnectivityServiceTest, TH
new test in this patch that fails before but succeeds after
Change-Id: I2e48dae28ff92045f002cfb2798d383c9c19d5ed
Currently, the test http server will respond whenever
http request is read, no matter how much data was declared
in the Content-Length header. For tests that uses POST
request to test uplink traffic this is not good enough.
Invoke parseBody to read data from input stream to make
sure the http body is read.
Test: atest android.net.NetworkStatsIntegrationTest \
--rerun-until-failure 100
Bug: 139774492
Change-Id: I1b71f3e55747d104e4a8796611517d93f178321f
For testing purposes, a TestNetworkInterface provides a
FileDescriptor which allows content injection on the test
network. However, this could be hard to use because the
callers need to compose IP packets in order to inject
content to the test network.
In order to remove the need of composing the IP packets,
this class forwards IP packets between two
TestNetworkInterface instances. Thus, the TCP/IP headers
could be parsed/composed automatically by the protocol stack of
this additional TestNetworkInterface, while the payload is
supplied by the servers run on the interface.
Test: 1. atest android.net.NetworkStatsIntegrationTest
2. atest com.android.cts.net.HostsideVpnTests
Bug: 139774492
Change-Id: I8fe5a434d6d727a81d106a967dcdca157424e12e
This is also needed by integration test in NetworkStack module
in follow-up CLs. Move to a common place first.
This is a no-op refactoring.
Test: atest com.android.cts.net.HostsideVpnTests
Bug: 139774492
Change-Id: Ifc7ed4c93edfb0f6f8eb47231f6df40332d2c10c
This method is better removed, because it doesn't follow the
naming conventions we want to keep in this file. It also isn't
useful :
• There is only one use of it outside tests, and it's in the
same file. It's trivial to inline it.
• The method has a unit test, which becomes useless once the
method is inlined.
• There is a corresponding command in the interpreter, but it's
only used by the unit test and therefore can be removed once
the unit test is removed.
Test: TH
Bug: 157405399
Change-Id: Ib5b1369ac28e4577adc98204e42ff2f27729e64c
This is no longer used and is advantageously replaced
by a call to poll(), which has the same semantics.
Test: TH
Bug: 157405399
Change-Id: I3182fd3e3ac749e11a8f962ef1acfdca5d031b05
This is not useful because it has the exact same semantics
as poll() : it returns the first event that matches the
predicate within the timeout, or null if none.
Unfortunately the method can't be removed until all
uses in internal master are removed, so the actual
removal will have to wait for the next patch.
Test: TH
Bug: 157405399
Change-Id: I471c44568e359f8686dcb21ae04c76ca8095f02f
It's a reason, so it's a lot clearer this way
Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: Id71d710a33b4df3c211e40141adb2aa0a535f458
This is not clearer than using the base method.
Test: ConnectivityServiceTest NetworkStaticLibTests
Bug: 157405399
Change-Id: Iac9aeffb563d0a1cb6c1287b46b9bbfffc0c75ca
The annotation is used to verify behavior for apps with max target SDK
33.
Bug: 267102290
Test: atest CtsNetTestCasesMaxTargetSdk33
Change-Id: I71ba4433389ba07553ea3d6d34a2bf64fdc132ad