Commit Graph

1171 Commits

Author SHA1 Message Date
jovanak
2045aa4777 Merge "Fixing NetworkWatchlistTest#testGetWatchlistConfigHash for secondary users." into pie-cts-dev
am: 4e9043b8cf

Change-Id: I5417f214cd337c3d0b517b160d753d808e9e3f59
2019-05-30 13:44:48 -07:00
Luke Huang
3df5aa1233 Merge "Add bypass private DNS test case and null network test for DnsResolver cts" 2019-05-30 11:22:50 +00:00
Junyu Lai
a73f8f6ec5 Merge "Fix keepalive CTS fail for devices with kernel older than 4.8" 2019-05-30 05:05:10 +00:00
paulhu
e3288fddcd Fix ConnectivityManagerApi23Test failures and remove duplication.
1. All ConnectivityManagerApi23Test were failed due to
   WifiManager#setWifiEnabled doesn't allow to use since
   Android Q. So we need to use shell command to enable/disable
   Wi-Fi instead.
2. Some methods are duplicated between
   ConnectivityManagerApi23Test and ConnectivityManagerTest, but
   they are not identical. So put these methods into
   ConnectivityUtils to clean up duplications and prevent fork
   happened again.

Bug: 133334943
Bug: 133209319
Test: Run the below tests on Crosshatch, Sailfish, Bonito.
      atest CtsNetApi23TestCases
      atest CtsNetTestCases

Change-Id: Ic37111cb12a46f5c36c2be887250c5d762216f6e
Merged-In: I075b7408d2a1e1145c7a9031075e07fa1db37fed
Merged-In: I0c02357eff07b98c1745de35d08ae6b8349de7fb
Merged-In: I04d1e1d096bcd4a9626cf9f00396fca7f9892a82
2019-05-30 01:25:20 +00:00
junyulai
063b4e109e Fix keepalive CTS fail for devices with kernel older than 4.8
If kernel < 4.8 then it doesn't support get socket option
TCP_REPAIR_WINDOW, thus TCP keepalive cannot be supported.
However, it might still support NAT-T keepalive. Test TCP
keepalive only if it is supported by kernel.

Bug: 133652079
Test: atest android.net.cts.ConnectivityManagerTest#testMajorMinorVersionCompare \
    android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimit \
    android.net.cts.ConnectivityManagerTest#testSocketKeepaliveUnprivileged \
    android.net.cts.ConnectivityManagerTest#testKeepaliveUnsupported \
    android.net.cts.ConnectivityManagerTest#testCreateTcpKeepalive

Change-Id: I3f8456deea2b4ded762a413c8e27b58ce54ce0aa
2019-05-29 17:15:53 +08:00
Luke Huang
1f5f11e681 Add bypass private DNS test case and null network test for DnsResolver cts
1. add test case for testing bypass Private DNS
2. add null network test
3. minor change for cleanup

Bug: 130594022
Test: atest DnsResolverTest
Change-Id: I2da65fc1267a1975e014c0aafe2ae47df075b712
2019-05-29 12:04:48 +08:00
Benedict Wong
6d82630b8f Merge changes I3babc72d,I79d231e2
* changes:
  Fix IPsec CTS tests for interface address checking
  Convert IPsec tests to JUnit4
2019-05-28 21:44:06 +00:00
jovanak
db6336c0b8 Fixing NetworkWatchlistTest#testGetWatchlistConfigHash for secondary users.
Avoids relying on external storage and using the hardcoded /sdcard/ path.
Unrooted adb does not have access to non-user 0 sdcard paths, and so the "cp"
command fails when the test runs in user 10.

Fixes: 121400865
Test: cts-tradefed run cts-dev -m CtsNetTestCases -t android.net.cts.NetworkWatchlistTest#testGetWatchlistConfigHash in user 10.
Change-Id: Idc667072bcfbbe159416fa7c7b6b19045b52041d
2019-05-24 12:21:50 -07:00
paulhu
5f7599b6d5 Ignore all tests in IpSecManagerTunnelTest with instant apps
Test runner will crash while tring to get test network service
in IpSecManagerTunnelTest. Because MANAGE_TEST_NETWORKS
permission can't be granted to instant apps. So ignore all tests
in this file.

Bug: 133399750
Test: atest CtsNetTestCases --instant
Change-Id: I5a096f20ec168133dbb65d27d3388c01e6ee895b
2019-05-24 11:37:37 +08:00
Benedict Wong
5c79356068 Fix IPsec CTS tests for interface address checking
Fixes two potentially device/kernel specific, or flaky bugs:
1. Java interface checking by name seems to cache the lookup, resulting
in interface address checks occasionally failing (on delete).
2. Link-local addresses appear to be added on all links for some set of
kernels and devices.

This patch addresses both by only checking that the requested address
was added via a address-based NetworkInterface lookup.

Bug: 72950854
Test: Ran on sargo-eng on qt-dev/HEAD
Test: Manually verified that the addresses are indeed added/removed
Change-Id: I3babc72dfe72337c4d68facb1695aec15e504c90
Merged-In: I3babc72dfe72337c4d68facb1695aec15e504c90
(cherry picked from commit 4af108aacf)
2019-05-22 11:08:26 -07:00
Benedict Wong
a8d59c0183 Convert IPsec tests to JUnit4
This patch fixes an incompatibility where some tests in the same
hierarchy were using Junit3, and other Junit4

No functional test changes made

Bug: 72950854
Test: Ran on devices, working
Change-Id: I79d231e202ba25ad5f57b44b387bebd7f012aa95
Merged-In: I79d231e202ba25ad5f57b44b387bebd7f012aa95
(cherry picked from commit 0d08e91fe7)
2019-05-22 11:08:26 -07:00
paulhu
435166fa86 Enable instant app mode for CtsNetTestCases
1. Indicating CtsNetTestCases support instant app mode but
   ignore some tests that cannot run in instant app mode.
2. Move some tests which need to test on API 23 into
   CtsNetApi23TestCases module due to instant app package
   must target at least API 26.

Bug: 123366918
Test: atest CtsNetTestCases --instant
Test: atest CtsNetApi23TestCases
Test: atest FrameworksNetTests

Change-Id: I4e828cbc48143e36c1be38b91c3c698122d4be5a
Merged-In: I1d78349d14763c133e1eab020d26865f46ff19a3
Merged-In: I931369875c86a396a898682009337cef1b918ba4
Merged-In: Ia8a45d6d751be94f9f707f879ea6ce4e6a45fae1
2019-05-22 01:11:10 +08:00
junyulai
80ec50b8ae add cts for unprivileged keepalive slots
Currently, unprivileged Nat-T keepalives are limited to 1 slot
per uid. Add CTS to verify that the keepalive slots are limited
as customized for unprivileged requests.

Bug: 129371366
Test: atest android.net.cts
      .ConnectivityManagerTest#testSocketKeepaliveUnprivileged
      --generate-new-metrics 10

Change-Id: I60b9e9ae9cf2b63490493ced9738cd2f402c3f9b
2019-05-13 18:10:36 +08:00
junyulai
b41bc72ea3 [KA14] add cts for keepalive limit test.
Per SDK requirement, OEM is required to support minimum number of
concurrent keepalives. Implement CTS to verify this.

Bug: 129371366
Test: atest android.net.cts
      .ConnectivityManagerTest#testSocketKeepaliveLimit
      --generate-new-metrics 10

Change-Id: I8be89116bed5c4dedb2ca42b6d633aa9e8c6a49a
2019-05-13 18:10:23 +08:00
Benedict Wong
81e51bce50 Merge "Enforce IPsec Tunnel mode for Android Q" 2019-05-10 17:41:04 +00:00
Benedict Wong
084c8b47b6 Enforce IPsec Tunnel mode for Android Q
This commit adds a second condition to whether the device is expected to
have the tunnel mode feature. If a device's first API/launch version is
Q or above, require IPsec tunnels

Bug: 72950854
Test: Ran on device with first API level < Q and == Q.
Change-Id: I7b849ad24a04b6b7899a80f1856236b5ceb5a839
2019-05-10 01:22:13 -07:00
Benedict Wong
54c0726220 Merge changes Ic4181fc8,Icffeed2e,I9fdba4a9
* changes:
  Add IPsec Tunnel mode data tests
  Add utilities to generate packets
  Add TunUtils as utility to reflect packets
2019-05-09 20:51:01 +00:00
Benedict Wong
64e64ff454 Add IPsec Tunnel mode data tests
This change adds single-direction tests for the IPsec Tunnel Mode API.
In the outbound direction, TUNs are used to capture outgoing packets,
and values are inspected. In the inbound direction, packets are built
manually, using the PacketUtils framework. Additional testing for
end-to-end integration tests will follow in aosp/941021 using packet
reflection via the TUN.

Bug: 72950854
Test: This; passing
Change-Id: Ic4181fc857fa880db5553314efa914f870dbe87c
2019-05-09 11:25:15 -07:00
Benedict Wong
75fb3d002e Add utilities to generate packets
This change adds utility methods to generate packets incrementally. It
supports UDP, ESP, IPv4, IPv6 packet generation.

For ESP, it exclusively does AES-CBC, HMAC-SHA256.

Bug: 72950854
Test: This
Change-Id: Icffeed2ebb2005d79faf04f48fd5126d1d6fb175
2019-05-09 11:25:06 -07:00
Benedict Wong
4243c834ce Merge "Check for IPSEC_TUNNELS feature before running CTS tests" 2019-05-08 20:04:06 +00:00
Benedict Wong
65845a7e50 Add TunUtils as utility to reflect packets
This patch adds a TunUtils class, allowing for packet capture over a TUN
interface, inspection of some basic header fields, and reflection of
packets with flipped src/dst headers.

Bug: 72950854
Test: Ran, passing
Change-Id: I9fdba4a905886c7a4820d86ef52c0cc1843215b2
2019-05-07 19:24:17 -07:00
Benedict Wong
437eb03a33 Check for IPSEC_TUNNELS feature before running CTS tests
If tunnel feature does is not present, skip tests.

Bug: 117183273
Test: This
Change-Id: I62fcc2cbca8bf3d2b70da5646303a7059a0df663
2019-05-07 19:24:14 -07:00
Sasha Smundak
b3af5c95b2 Convert hostsidetests/net/**/Android.mk file to Android.bp
See build/soong/README.md for more information.

Bug: 122332514
Test: atest CtsHostsideNetworkTests
(same failures as in baseline)
Change-Id: I5b6a22263331b19570b42f156d7ad5d59f8208b4
2019-04-29 13:18:42 -07:00
Luke Huang
4df605b6a4 Convert Android.mk to Android.bp for net cts
Bug: 130623306
Test: atest CtsNativeNetTestCases CtsNativeNetDnsTestCases
      atest CtsNetTestCases

Change-Id: Ifc69f6f83161a44b663e6afdf034963ad241a6b5
2019-04-23 09:27:27 +00:00
Chalard Jean
83e71f6401 Add a test for a bugfix in UrlQuerySanitizer
...so this does not happen again.
This is a test for the fix in Ic91660d974dce21f2affdcacaeffe9accf8451ac

Bug: 1866121
Test: This
Change-Id: Ib7ee866f65baf99b46a31e2115355a42a829421e
2019-04-22 21:58:46 +09:00
Varun Anand
1806a7da53 Merge "CTS tests related to VPN meteredness." 2019-04-15 13:45:57 +00:00
Luke Huang
f1dc4d4380 Minor changes for DnsResolverTest
Done for code-style nits from aosp/940128.

Bug: 129395490
Test: atest DnsResolverTest
Change-Id: Ia4db272cc1a4687b3749116375bac0efb37420d8
2019-04-12 10:34:14 +08:00
Luke Huang
ea5e4a5409 Merge "DnsResolver cts changes to match API council requests" 2019-04-12 00:45:18 +00:00
Lorenzo Colitti
75c73cda26 Merge "Add instant and ABI XML tags for hostside networking tests." 2019-04-11 23:52:10 +00:00
Varun Anand
d1008aa730 CTS tests related to VPN meteredness.
Tests cover scenarios related to whether VPN has explicitly declared its
underlying networks plus whether it is an always metered VPN.

For each of these scenarios, we ensure VPN meteredness based on its
capabilities and ConnectivityManager#isActiveNetworkMetered matches.

Bug: 123727651
Test: atest HostsideVpnTests
Change-Id: I3030e5468a55bbc32be2a753f098dcf7f0256af8
2019-04-11 14:32:21 -07:00
Lorenzo Colitti
ad17ee9e92 Add instant and ABI XML tags for hostside networking tests.
These are not multi-ABI because the behaviour does not depend on
the ABI of the app. Some of the APIs are ultimately backed by JNI
code in the system server, but that only depends on the system
server's ABI, not the app's.

Enable instant mode because these applications are subject to the
same network restrictions as other apps.

Fix: 123364589
Test: atest CtsHostsideNetworkTests
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsHostsideNetworkTests
Change-Id: Ib3c4cd365ffe95889d51a236f035ea84516f0abd
2019-04-11 20:43:59 +09:00
Luke Huang
4b1fab0dd0 DnsResolver cts changes to match API council requests
Bug: 129261432
Test: atest DnsResolverTest
Change-Id: I803f10218a01614ba7fb26597971853e602273c6
2019-04-10 15:39:21 +08:00
Adam Vartanian
5227dbe606 Add test for SslError.getCertificate()
Bug: 129200144
Test: cts -m CtsNetTestCases -t android.net.http.cts
Change-Id: I1b23746865a4bffc90847b30384defd2c7d49879
2019-04-09 15:46:20 +01:00
Lorenzo Colitti
aaac541459 Merge "Merge "Merge "Merge "Fix expected reverse lookup of Google DNS IP addresses" into nougat-cts-dev am: 3b416dd354" into nougat-mr1-cts-dev am: 50491fb1cc" into oreo-cts-dev am: b6d3940f89" into oreo-mr1-cts-dev
am: d93f6d545c

Change-Id: Ie4a894d0d07dd2f26ef63efbb83a4531110f84aa
2019-04-08 19:38:21 -07:00
Lorenzo Colitti
926ebf2d47 Merge "Merge "Merge "Fix expected reverse lookup of Google DNS IP addresses" into nougat-cts-dev am: 3b416dd354" into nougat-mr1-cts-dev am: 50491fb1cc" into oreo-cts-dev
am: b6d3940f89

Change-Id: Iacbf91536898e4b0d8942581593ab87eae0af323
2019-04-08 17:52:15 -07:00
Lorenzo Colitti
454f3193a3 Merge "Merge "Fix expected reverse lookup of Google DNS IP addresses" into nougat-cts-dev am: 3b416dd354" into nougat-mr1-cts-dev
am: 50491fb1cc

Change-Id: Ie5459302cb2aa040ed44747f189434091e1c4786
2019-04-08 17:06:38 -07:00
Lorenzo Colitti
fe13c7233d Merge "Fix expected reverse lookup of Google DNS IP addresses" into nougat-cts-dev
am: 3b416dd354

Change-Id: I03a2f6f3631c25868d504892c5b885477dcfeb01
2019-04-08 16:31:57 -07:00
Treehugger Robot
9709b60914 Merge "DO NOT MERGE:CDD Annotation for 7.4.7/C-2-1" into pie-cts-dev 2019-04-08 19:40:27 +00:00
Lorenzo Colitti
3a984ca812 Fix expected reverse lookup of Google DNS IP addresses
DnsTest.testDnsWorks expects that reverse lookup for the Google
public DNS servers will return something with google.com in the
name. This no longer works because the reverse DNS entries have
changed to dns.google.

Bug: 129452237
Test: atest android.net.cts.DnsTest.testDnsWorks
Change-Id: Iee8bfe418bf6003e5c78df77d75f6f9745249267
Merged-In: Iee8bfe418bf6003e5c78df77d75f6f9745249267
(cherry picked from commit 3852fd92f5)
2019-04-08 00:21:48 +00:00
saurav subedi
d11be5bbeb DO NOT MERGE:CDD Annotation for 7.4.7/C-2-1
Devices that don't provide data saver mode must return
RESTRICT_BACKGROUND_STATUS_DISABLED for the
ConnectivityManager#getRestrictBackgroundStatus()

Bug:130032710
Test: make cts
Change-Id: I81b52c9d26afcf51a7e416d20589c9c7cfb878f6
2019-04-05 20:23:53 +00:00
Treehugger Robot
3604dbe2de Merge "Add FrameworksNetCommonTests to CTS" 2019-04-04 12:29:44 +00:00
Mark Chien
e8fb173b7d Merge "[KA09] add cts test for tcp keepalive offload" 2019-04-03 09:36:52 +00:00
Remi NGUYEN VAN
16fc55e30d Add FrameworksNetCommonTests to CTS
The common tests include tests that must be both in CTS and unit tests.

Bug: 129199908
Test: atest CtsNetTestCases, IpPrefixCommonTest is run and passes.
Change-Id: Id16f40247cca9a6c5bba573006b84547727f1bab
2019-04-03 18:06:33 +09:00
markchien
5dc1681823 [KA09] add cts test for tcp keepalive offload
Add a test case to make sure tcp keepalive offload starts
correctly.

Bug: 114151147
Test: atest ConnectivityManagerTest#testCreateTcpKeepalive
Change-Id: Iaf1c2fab755f3df8e866b4988f64c25906e1737a
2019-04-03 13:50:39 +08:00
Junyu Lai
553872fc04 Merge "Fix tests in TrafficStatsTest that are affected by adb over network" 2019-04-02 02:00:25 +00:00
Lorenzo Colitti
718025ed2c Merge "Add test coverage for ICMP echo constants." 2019-04-01 15:08:44 +00:00
junyulai
c1419d913d Fix tests in TrafficStatsTest that are affected by adb over network
If the adb TCP port is opened, this test may be run by adb over
network. Huge amount of data traffic might go through the
network and accounted into total packets stats. The upper bound
check would be meaningless.

Bug: 126320702
Test: atest android.net.cts.TrafficStatsTest 10 trials for both cases

Change-Id: Iaee455826dc01741c6a3a9f5f8096361c69a1e7c
2019-04-01 11:12:16 +08:00
Lorenzo Colitti
950e10572b Add test coverage for ICMP echo constants.
Bug: 129251251
Test: atest android.net.ipv6.cts.PingTest com.android.cts.net.HostsideVpnTests
Change-Id: Icca18e0870588ca250225ce79cf30dbd8c361e84
2019-03-30 02:11:46 +09:00
Luke Huang
8fd0506401 Add more test for async DNS api
Bug: 129395490
Test: atest DnsResolverTest
Change-Id: I4d2cdc2be577846c08dfe994da60965f983acb97
2019-03-29 17:09:57 +08:00
Luke Huang
92f1edd2f0 Improve cancellation test for async DNS API
After having a lock between callback and cancellationsignal,
errno with EBADF should not happen.

Bug: 129317069
Test: atest DnsResolverTest
Change-Id: I08e800b078d40345eb3f46da1323db251c8dcd47
2019-03-28 21:06:30 +08:00