Commit graph

2,995 commits

Message SHA1
Merge "Add useful utils to CollectionUtils"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-11-15 08:50:19 +00:00
55de7e4c84
Merge "[ST03] Add test dns server for integration tests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-14 14:01:12 +00:00
40b76e8bac
Add useful utils to CollectionUtils
Test: new tests in this patch
Change-Id: I9cca999f9235d4d6508533230afcd8ee0c1c54c1

Chalard Jean   commited 2022-11-14 20:47:59 +09:00
43bb172e82
Merge "Move DeviceConfigRule to libs/net"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-14 09:34:58 +00:00
1a81ae4eb9
Merge "Add eventuallyExpect method that takes mark"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-11-14 05:55:58 +00:00
c32afc4238
Merge "[CC08] Remove expectCallback*"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-11-11 03:17:42 +00:00
664e53bd88
Move DeviceConfigRule to libs/net
The utility can be useful for tests in several repositories, not just
CTS.

Test: m
Change-Id: Id4c653793e58d91d604b388a06a7c137ed020110

Remi NGUYEN VAN   commited 2022-11-10 18:10:24 +09:00
7356d356fb
Add eventuallyExpect method that takes mark
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Fix: 254188130
Change-Id: I98ea8aef5cb21ee92ce47d97d2f9c81448b1cd9e

Junyu Lai   commited 2022-11-10 14:35:29 +08:00
53a6b7053d
Merge "Revert "add bpf_for_each_map_elem() helper definition""
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-11-07 23:36:35 +00:00
91e4845301
Merge "Add option to validate DUN networks"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-04 11:14:41 +00:00
5043f90f0f
Add option to validate DUN networks
When isDunValidationRequired is true, networks with DUN capability will
always be validated. Otherwise previous behavior will apply.

Bug: 253989196
Test: atest NetworkMonitorTests
Change-Id: I6e8bc7fcbf561f636abbf42ca69749fd0eabfd6c

Remi NGUYEN VAN   commited 2022-11-04 17:05:49 +09:00
8076110105
Revert "add bpf_for_each_map_elem() helper definition"
This reverts commit 8711ae5494a3011f48543987fa08872d775df652.

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

Maciej Żenczykowski   commited 2022-11-02 08:39:20 +00:00
61e21fff0b
[ST03] Add test dns server for integration tests
Bug: 139774492
Test: atest DnsAnswerProviderTest TestDnsServerTest
Change-Id: Ia5039a47f4b818efb09aab8174beb9d921339c3d

Junyu Lai   commited 2022-11-02 11:18:48 +08:00
be99103196
Remove @Nullable from byte
Primitive types can't be null.

Change-Id: Idc2a30b1faae69213bc3bd7262f72d4ec23e1c40
Test: m

Remi NGUYEN VAN   commited 2022-10-31 08:01:30 +00:00
e57ae65216
Merge "Add debug log in ensureWifiConnected"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-10-31 01:38:57 +00:00
97d0f3a563
Add debug log in ensureWifiConnected
It's sometimes not clear that tests call ensureWifiConnected
but no wifi enabled. It's hard to clarify design with wifi
stack, so add the gotten wifi info in the log to help on
debugging.

Bug: 252869312
Test: atest CtsNetTestCases
Change-Id: I3bc74dd38dd5a36a93510fc5d70c0fa00b66e842

chiachangwang   commited 2022-10-28 01:13:40 +00:00
b5e9e3fc2b
Merge "trivialize SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-10-26 23:08:16 +00:00
4bc5fd7ad3
Merge "Fix errorprone warnings that should be errors"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-10-26 21:09:23 +00:00
9c549c0d53
trivialize SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED
Bug: 255652639
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3732bbd7ad9e4e06c914206560268bd1ce8204f4

Maciej Żenczykowski   commited 2022-10-26 03:05:32 +00:00
203d5e0dcd
Merge "Add ByteUtils for byte utility functions"
Paul Hu   authored and   Gerrit Code Review   commited 2022-10-26 01:05:55 +00:00
281e7a2587
Merge "Bug: b/255652639"
Chris Sabotta   authored and   Gerrit Code Review   commited 2022-10-25 23:40:44 +00:00
87e48d453e
Bug: b/255652639
Revert "remove SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED"

This reverts commit 319d8468ad90d33307ce764e7f6130587ce81419.

Reason for revert: Build breakage, (First bad build: 9217822)

Change-Id: I0db2bdb68006f9379bb149f7de9fa81ace501c3d

Chris Sabotta   commited 2022-10-25 23:38:32 +00:00
33f1f3f74c
Merge "remove SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-10-25 22:10:11 +00:00
713c112d23
remove SKIP_IF_BPF_SUPPORTED
as this does not appear to be used anywhere anymore

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

Maciej Żenczykowski   commited 2022-10-25 09:27:08 +00:00
5897a805ea
remove SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED
as this does not appear to be used anywhere anymore

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

Maciej Żenczykowski   commited 2022-10-25 09:24:59 +00:00
52605df5fd
Add ByteUtils for byte utility functions
Bug: 254155029
Test: atest NetworkStaticLibTests
Change-Id: I996ead6f23698313828e844672de5917efdfce69

Paul Hu   commited 2022-10-25 05:40:00 +00:00
528e675fdd
[CC08] Remove expectCallback*
These methods have been migrated to the shorter and better
provisioned expect<> family of methods.

Test: Builds
Change-Id: I60c77bfeabe373557d61f0f8d0295b385fe5271e

Chalard Jean   commited 2022-10-24 18:54:46 +09:00
0eac837b01
[CC07] Add build tests for expect* versions
Also address some comments left on a previous patchset.

Test: NetworkStaticLibTests
Change-Id: I3ea16bb54aec31ddb0368af980483109a1bdb49b

Chalard Jean   commited 2022-10-24 18:54:45 +09:00
6f8bcae7d0
Merge "[CC06] Move usage of expectCallback* to expect"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-10-24 04:22:18 +00:00
041f81ec85
Merge "Disallow pre-T use of userspace writable bpf map arrays with more than 1 element."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-10-21 03:58:21 +00:00
9e4d8a3221
[CC06] Move usage of expectCallback* to expect
See CC03 (aosp/2255619) for details

Test: NettworkStaticLibTests
Change-Id: Id15560f5744024ff2ac2acbaf4de83818ce6efc5

Chalard Jean   commited 2022-10-21 11:53:13 +09:00
3ad176b03a
Merge "Increase the timeout for eventuallyExpect"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-10-21 02:51:11 +00:00
ca89fc43a8
Disallow pre-T use of userspace writable bpf map arrays with more than 1 element.
Bug: 254543135
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I11ea5edaebf08f3492ad79f059afa98b50f80df3

Maciej Żenczykowski   commited 2022-10-21 00:04:03 +00:00
6f9830c342
Increase the timeout for eventuallyExpect
Sometimes the tests are run under high load, e.g. immediately
after boot while all apps that listen for the boot completed
broadcast run their listeners. Under these circumstances,
40ms of leeway is tight ; on recent Android devices HZ is
commonly 100 too, meaning a general time unit of 60 will give
a little bit of air.

The drawback in this is that the test is less stringent on
TrackRecord, which as a multi-thread primitive should have
really tight tests to make sure that a non-threading primitive
(e.g. a polling implementation) doesn't pass. This patch makes
the testing on that front a little bit less reliable.

Note that this patch won't actually fix all flakes in that it
isn't really possible to guarantee the device will have any
CPU time to run the test at all anyway, but this should make
most failures go away.

Also, the argument for the time unit is never used, and can
be removed ; at least, the possibility of the timeArg() func
not using the same value as the sleep directive is scary, so
that possibility should be removed. If the time unit argument
is ever needed it can be added back, but considering the arg
has been available for years and never used, it's unlikely.

Test: NetworkStaticLibTests
Fixes: 254188131
Change-Id: Ia7a4fe775942484dcd7dc223c7710e82a8329beb

Chalard Jean   commited 2022-10-20 16:42:16 +09:00
347dd8ded4
add DEFINE_BPF_MAP_RO for output maps which userspace should never modify
Bug: 254543135
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I94c5e68e8941a264ea3671f75e3ad9c37ded8894

Maciej Żenczykowski   commited 2022-10-20 04:06:37 +00:00
dd3fe1d750
[CC04] Have TestNetworkTracker implement HasNetwork
This already has all necessary methods, it only needs to
declare it implements the interface.

Test: ConnectivityServiceTest
Change-Id: I8de643f2b8de9765c25c3efe934c94549f341a51

Chalard Jean   commited 2022-10-19 15:46:35 +09:00
f79ca2809a
[CC03] Replace expectCallback* with expect
"callback" is redundant – it's a TestCallback object and
it takes a type of callback anyway.

"assertNextIs" is shorter than expectCallback, and more
directly explicit than "expect", but it's also 3 words
and very different from previous usage.
Using expect() is a little bit less in-your-face obvious,
but it's simple, familiar, and short.

Test: CtsNetTestCases
      FrameworksNetIntegrationTests
      FrameworksNetTests
      NetworkStackTests
Bug: 157405399
Change-Id: I6c8c85a8be3895dd8f0ef681faa4a8b2b4f2f493

Chalard Jean   commited 2022-10-18 20:18:46 +09:00
b7e2284acf
[CC01] Remove the confusing pollForNextCallback
In Java, "poll" methods return null when the collection is
empty. Respect this convention.

Bug: 157405399
Test: FrameworksNetTests
Change-Id: I3b17908f9ce1f60b18908605a645da3199c010b9

Chalard Jean   commited 2022-10-17 14:51:53 +09:00
70c62e594a
Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I772563b5e54b468a755520d2ed9b78bcb5fc3ad6

Cole Faust   commited 2022-10-15 21:33:31 -07:00
f4dd77109e
Merge "Move bit utility methods to a new BitUtils class."
Jean Chalard   authored and   Gerrit Code Review   commited 2022-10-14 04:55:25 +00:00
4152f83b27
Save one minute in executing NetworkStaticLibTests
The default timeout for expectEventually is 30 seconds, so this
test used to take one minute. With this change, it now only takes
50ms, with virtually no change in safety.

Test: NetworkStaticLibTests
Change-Id: Id8d6a738ea6a70f7d901a7659b2160c2f3d7d2c0

Chalard Jean   commited 2022-10-13 16:41:29 +09:00
5c6f7809e2
Move TestableNetworkCallbackTest to f/l/n
This tests a utility in f/l/n, so it should live together with
it and not in the network stack tests

Test: NetworkStaticLibTests NetworkStackTests
Change-Id: I90d12933e3a82eba4b565022d3df1e7c1d503f56

Chalard Jean   commited 2022-10-13 16:41:28 +09:00
cd0fc3d71b
Correct failed log in ensureWifiConnected()
The timeout is used in the test should be WIFI_CONNECT_TIMEOUT_MS
but log shows WIFI_CONNECT_INTERVAL_MS instead. The debug log is
confusing. Correct it to right variable.

Test: atest CtsNetTestCases
Change-Id: I4cedaa6e03aea6cc02a07bdbea2f0b1e7f5076e1

chiachangwang   authored and   Chiachang Wang   commited 2022-10-12 14:14:49 +00:00
8d65699533
Move bit utility methods to a new BitUtils class.
In particular this moves NetworkCapabilies#
appendStringRepresentationOfBitMaskToStringBuilder to this
class. It also moves some other NetworkCapabilitiesUtils
methods that are better homed in this new class.

Test: new test in this patch
Change-Id: I16374d7ca1da92052bb814bde796602d62f5c42e

Chalard Jean   commited 2022-10-12 20:31:20 +09:00
2ecf120256
Merge "add bpf_for_each_map_elem() helper definition"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-10-07 19:45:57 +00:00
45b9d2d0f9
Enlarge the TestableNetworkCallback default timeout
TestableNetworkCallback is using on both unit and cts tests with
same timeout 200ms. For unit tests, most of objects are mock, so
the callback should respond quickly and this interval is fine.
But for cts tests, they are running on the real system and the
callback time will depend on the system which may be over 200 ms
sometimes if the system is busy or has performance problems. So
enlarge the Network Callback default timeout to 500ms that can
reduce the test flake on cts tests. To ensure there is no impact
on no callback check, add the no callback timeout 200ms which is
the same timeout as before.

Bug: 245000567
Test: Run the FrameworksNetTests CtsNetTestCases and check
      no running time increase.
Change-Id: I31f8bc08f65a622f6ab9b6c7f0577f0b107440c1

Paul Hu   commited 2022-10-04 07:05:14 +00:00
561b97e711
add bpf_for_each_map_elem() helper definition
See 5.12+ kernel's include/uapi/linux/bpf.h

(note that since bpf is 64-bit, int and long are the same thing)

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

Maciej Żenczykowski   commited 2022-09-27 23:14:51 +00:00
c5dcf2c8ea
Merge "[ST02] Add methods for synthesizing DNS packets"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-09-22 02:39:42 +00:00
e766a09b79
Merge changes from topic "test-tethering-icmp"
* changes:
  IpUtils: add ICMP checksum calculation function
  NetworkStackConstants: add ICMP checksum offset constant

Nucca Chen   authored and   Gerrit Code Review   commited 2022-09-19 15:53:43 +00:00
48a33adc7b
IpUtils: add ICMP checksum calculation function
Bug: 237369591
Test: NetworkStaticLibTests
Change-Id: If45de190872cad588f9b9104828a0d8116fc158b

Hungming Chen   commited 2022-09-19 15:34:33 +08:00
0aa70a0973