Commit Graph

3193 Commits

Author SHA1 Message Date
Junyu Lai
e5cca4e40e Merge "Resolve resource ID at runtime to stabilize tests" into qt-r1-dev 2019-07-05 07:24:16 +00:00
junyulai
5764173a9f Resolve resource ID at runtime to stabilize tests
This change also remove some unused references.

Bug: 136638851
Test: atest android.net.cts.ConnectivityManagerTest

Change-Id: Ic44b31ed9acc48b9bcba7e1e70cc18a65bc0a8f6
2019-07-05 10:29:04 +08:00
markchien
70808176ce Merge "[automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b -s ours am: 956b28af13 -s ours am: b8b8d703d9 -s ours
am: f090f3de05 -s ours
am skip reason: change_id I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629 with SHA1 d51ae5760d is in history

Change-Id: I79f36a32d6415390ddfce6eacce3bffca3d7c11e
2019-06-27 09:34:22 -07:00
markchien
f090f3de05 Merge "[automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b -s ours am: 956b28af13 -s ours
am: b8b8d703d9 -s ours
am skip reason: change_id I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629 with SHA1 d51ae5760d is in history

Change-Id: Ic9514c32f1e0c6e9565b114f98f02cb4c97d35b7
2019-06-27 09:25:11 -07:00
markchien
21830f0f86 [automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b am: 04118c8a30 am: caee99b3cf -s ours am: 5ecbd991d5 -s ours
am: cdef8b40ad -s ours
am skip reason: change_id I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629 with SHA1 de0f268f78 is in history

Change-Id: I3bd1878cdc5b94797309928d150deb1accb9059c
2019-06-27 09:20:37 -07:00
markchien
b8b8d703d9 Merge "[automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b -s ours
am: 956b28af13 -s ours
am skip reason: change_id I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629 with SHA1 d51ae5760d is in history

Change-Id: I47ea61fd0bdc9c2b4fe080e29550b5fc0d2c1b38
2019-06-27 09:14:58 -07:00
markchien
cdef8b40ad [automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b am: 04118c8a30 am: caee99b3cf -s ours
am: 5ecbd991d5 -s ours
am skip reason: change_id Id6f986aacc3cadf713ebbc8305ca535b861390fc with SHA1 b84038696c is in history

Change-Id: I338e250514cd7b7c94d9eee24ce4ce738e000366
2019-06-27 09:06:08 -07:00
markchien
5ecbd991d5 [automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b am: 04118c8a30
am: caee99b3cf -s ours
am skip reason: change_id Id6f986aacc3cadf713ebbc8305ca535b861390fc with SHA1 b84038696c is in history

Change-Id: I216e490624ce14e2b4dacff9381a7d8c96276349
2019-06-27 08:56:58 -07:00
Android Merger
956b28af13 Merge "[automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b -s ours am skip reason: change_id Id6f986aacc3cadf713ebbc8305ca535b861390fc with SHA1 b84038696c is in history" into oreo-mr1-cts-dev 2019-06-27 15:51:06 +00:00
markchien
1547ce9dfa [automerger skipped] Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev
am: 0ff953bf1b -s ours
am skip reason: change_id Id6f986aacc3cadf713ebbc8305ca535b861390fc with SHA1 b84038696c is in history

Change-Id: Ia65a5ed54dd61a36d9f0f22fe2eae518c373230c
2019-06-27 08:50:57 -07:00
markchien
caee99b3cf Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev am: 0ff953bf1b
am: 04118c8a30

Change-Id: Ic76572a2585a338f8c08b473455031ef25c562c1
2019-06-26 21:37:47 -07:00
markchien
04118c8a30 Merge "Exempt adb socket for hostside VpnTest" into oreo-cts-dev
am: 0ff953bf1b

Change-Id: I94e8de44713f076783073371cca65c4b5579220e
2019-06-26 21:17:51 -07:00
Junyu Lai
2419976be4 Add CTS for creating keepalive offloads on cellular
Bug: 134352656
Test: atest android.net.cts.ConnectivityManagerTest (--instant)
Merged-In: Ia7b1111abe687efad032a8c9205990c97a769fcd
Change-Id: Ib6b01356d785c5b7684520eef9f9d1fe48187582
(cherry picked from commit 8550488c7cf0c0ab2af06189aca5ad50c39e5276)
2019-06-20 02:22:23 +00:00
Sudheer Shanka
aa42c35fac [automerger skipped] Merge "Skip battery saver related tests on unsupported devices." into pie-cts-dev am: e3c9363b92
am: 14586e59ae -s ours
am skip reason: change_id Ifec84425febf38d732367fae6b43fa80c427c79f with SHA1 802549c8de is in history

Change-Id: Ifb8f628a98a57a5845c476f29775b1bc4ec5a31a
2019-06-19 11:58:29 -07:00
Sudheer Shanka
14586e59ae Merge "Skip battery saver related tests on unsupported devices." into pie-cts-dev
am: e3c9363b92

Change-Id: Ib587d87add52de4d2e076876edbae7c519eb70ab
2019-06-19 11:44:23 -07:00
markchien
d51ae5760d Exempt adb socket for hostside VpnTest
Vpn test would destroy socket. If adb run over network, adb
socket would be killed during Vpn test. Then, test stop due to
adb disconnect.

Bug: 119382723
Bug: 135225500
Test: - build pass

Change-Id: I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629
Merged-In: I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629
Merged-In: Id6f986aacc3cadf713ebbc8305ca535b861390fc
(cherry picked from commit de0f268f78)
2019-06-19 08:21:00 +00:00
Sudheer Shanka
f8eb2722ff Merge "Skip battery saver related tests on unsupported devices." into qt-dev 2019-06-14 17:07:39 +00:00
Luke Huang
5e43421294 Add test with inline executor for DnsResolverTest
Makes general query test cases also take inline executor.
The new added test case testSequentialQuery with inline executor
will only pass after aosp/980686.

Bug: 134310704
Test: atest DnsResolverTest
      atest DnsResolverTest --instant
Change-Id: I135358fe45652277ed795a2f359f44f4db787c08
(cherry picked from commit 04596294eea3e5db4fd487cf6f8ef598daac606a)
2019-06-13 11:24:48 +08:00
Luke Huang
d3b7dec473 Fix DnsResolverTest for instant mode
add AppModeFull@ to DnsResolverTest since WRITE_SECURE_SETTINGS
could not be ganted in instant mode.

Bug: 134897744
Test: atest DnsResolverTest
      atest DnsResolverTest --instant

Change-Id: I267c19af1a1c5544ca752a364335ec728a478bb2
(cherry picked from commit 2af244f4127883ed967089f550f2cfe07936416d)
2019-06-13 11:24:25 +08:00
Pete Bentley
50795d03cd Update test host used for TLS host verification.
Temporary fix, this is still brittle to certificate changes
on the test host.

Bug: 134532880
Test: atest android.net.cts.SSLCertificateSocketFactoryTest
Change-Id: I6e8c8757963ef46009767925bfa512127d9daba7
Merged-In: I6e8c8757963ef46009767925bfa512127d9daba7
(cherry picked from commit 166e7121b173f2a4e3d6a9ded213e4c8679a9cfb)
2019-06-07 19:01:51 +01:00
Sudheer Shanka
8371c77499 Skip battery saver related tests on unsupported devices.
Bug: 133761301
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ifec84425febf38d732367fae6b43fa80c427c79f
Merged-In: Ifec84425febf38d732367fae6b43fa80c427c79f
2019-06-07 10:16:07 -07:00
Sudheer Shanka
802549c8de Skip battery saver related tests on unsupported devices.
Bug: 133761301
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ifec84425febf38d732367fae6b43fa80c427c79f
2019-06-07 10:14:08 -07:00
TreeHugger Robot
e49034996e Merge "Fix testNetworkSettingsPermission for headless User 0" into qt-dev 2019-06-05 18:40:35 +00:00
TreeHugger Robot
5c6f115514 Merge changes from topic "ipsec-tunnel-tests" into qt-dev
* changes:
  Remove mContext from IpSecBaseTest
  Add reflected-packet based data tests
  Cleanup IPsec CTS tests
2019-06-03 03:20:42 +00:00
Tomasz Wasilczyk
66fe5244ad Fix testNetworkSettingsPermission for headless User 0
This test fails on devices with headless user 0 when it tries to
verify apps with android:sharedUserId="android.uid.system" (and without
explicit ask for NETWORK_SETTINGS). Such apps get this permission
by default, but when running on user 1 they get UID 1001000, what doesn't
match SYSTEM_UID=1000.

By the chance of modifying this code, let's also add more verbose error
message (with UID), simplify it and reduce indentation count.

Bug: 120143468
Test: atest android.net.wifi.cts.WifiManagerTest#testNetworkSettingsPermission
Change-Id: Ifc09320cf738a518003126fad1ce31f5e38a3aff
2019-05-31 15:21:17 -07:00
Benedict Wong
d8a36dd745 Remove mContext from IpSecBaseTest
This commit removes the mContext from IpSecBaseTest, and replaces it
with InstrumentationRegistry.getContext().

Bug: 72950854
Test: Ran on devices, passing.
Merged-In: If6fa359825aa9d1f7d4c8d49aba7a34925c073ed
Change-Id: If6fa359825aa9d1f7d4c8d49aba7a34925c073ed
(cherry picked from commit 69760fb5b62ae0e36c2a88bb20502dead3d7589b)
2019-05-31 13:00:51 -07:00
Benedict Wong
2cb7034baf Add reflected-packet based data tests
This commit adds tests that reflect outgoing packets, flipping the outer
src/dst headers to avoid the need to tear down and rebuild the outer
TUN.

This allows us to at least test that our implementation can interoperate
with itself.

Bug: 72950854
Test: this, passing
Merged-In: Ia969f78f4c1a0c0a017f5aad425a68852ff4433a
Change-Id: Ia969f78f4c1a0c0a017f5aad425a68852ff4433a
(cherry picked from commit 144937f3df37ee0b1d5484f10e8c86a8a70a9cb5)
2019-05-31 13:00:30 -07:00
Benedict Wong
a0279520f0 Cleanup IPsec CTS tests
This commit addresses comments from aosp/963067 and aosp/959617.

No behavioral/functional changes were made, only renames and minor style
nits addressed.

Bug: 72950854
Test: Ran on devices, working
Merged-In: I1702b91e245412f0142e9e47b7fb373b9b4e8126
Change-Id: I1702b91e245412f0142e9e47b7fb373b9b4e8126
(cherry picked from commit 68237a11f9532ca6c59d579adb374fe40b0b3bee)
2019-05-31 13:00:15 -07:00
jovanak
0ac46bc583 Merge "Fixing NetworkWatchlistTest#testGetWatchlistConfigHash for secondary users." into pie-cts-dev am: 4e9043b8cf
am: e4c4e3e55a

Change-Id: I67e8569e9976f99888e4aba0fde16d784d691477
2019-05-30 13:48:57 -07:00
jovanak
e4c4e3e55a Merge "Fixing NetworkWatchlistTest#testGetWatchlistConfigHash for secondary users." into pie-cts-dev
am: 4e9043b8cf

Change-Id: I0696ee72052294a96d50425284d074dda8ea809a
2019-05-30 13:37:48 -07:00
Luke Huang
0b35214faa 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

Merged-In: I8dd48f11baf92d953ded237204a3c2cd3b58581d
(cherry picked from commit da665a0a78a2919c3e2edabafec463de3de9ddb7)

Change-Id: Iabb100c51fd80eca5ab0284bc891f4fb98492e8b
2019-05-30 11:58:52 +00:00
Junyu Lai
87ac083a3b 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: I0a3ff07c482bb7c8cb05663678c10afcc0500861
Merged-In: I3f8456deea2b4ded762a413c8e27b58ce54ce0aa
(cherry picked from commit 57d91e6276b50bf0dd78f3643c4a979f584fcf38)
2019-05-30 06:26:52 +00:00
paulhu
3cdc25cbc4 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
2019-05-29 19:53:47 +08:00
TreeHugger Robot
10b4eaa6f0 Merge "Convert Android.mk to Android.bp for net cts" into qt-dev 2019-05-28 08:14:58 +00:00
Luke Huang
971b79519a Convert Android.mk to Android.bp for net cts
Bug: 130623306
Test: Run the tests below on Crosshatch, Sailfish, Bonito
      atest CtsNativeNetTestCases CtsNativeNetDnsTestCases
      atest CtsNetTestCases

Merged-In: I5bb6de7a07494bd13d069212223691968d4f080e
(cherry picked from commit db29b055d9)

Change-Id: I0f1f70794c0ce303158f1aea54f0801379498071
2019-05-28 06:37:32 +00:00
Paul Hu
a138c9e487 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: I31b7e12a5a0021185851ba4435a6c42d457f34b6
Merged-In: Ia18c6bfe791692f8835b127adf734ce3d2a4ba95
Merged-In: I697333a7a64d794208d80112bdc1d1e50c5d2b56
Merged-In: I31b7e12a5a0021185851ba4435a6c42d457f34b6
(cherry picked from commit eb29c90465)
2019-05-27 01:19:17 +00:00
TreeHugger Robot
ac707024b2 Merge "Minor changes for DnsResolverTest" into qt-dev 2019-05-24 19:28:19 +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
Henry Tung
7058c3fbd8 Merge "Modify testNetworkSetupWizardPermission let it fit Factory Ota use case." into qt-dev 2019-05-24 07:03:31 +00:00
Henry Tung
0097cb240d Modify testNetworkSetupWizardPermission let it fit Factory Ota use case.
Bug: 131304475
Test: run cts -m CtsNetTestCases -t android.net.wifi.cts.WifiManagerTest#testNetworkSetupWizardPermission
Change-Id: I41a457e6f31fcf3c45b171937d61b6342e3c0946
2019-05-22 11:18:07 +08:00
paulhu
78e4a184a1 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
2019-05-16 16:07:07 +08:00
Benedict Wong
4af108aacf 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
2019-05-15 01:02:28 -07:00
TreeHugger Robot
c7774ffa16 Merge "Enforce IPsec Tunnel mode for Android Q" into qt-dev 2019-05-15 03:58:29 +00:00
junyulai
bbf160a93d 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

(Clean cherry-pick of aosp/957205)

Change-Id: I60b9e9ae9cf2b63490493ced9738cd2f402c3f9b
Merged-In: I60b9e9ae9cf2b63490493ced9738cd2f402c3f9b
2019-05-13 22:19:02 +08:00
junyulai
ad4c047f6d [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

(Clean cherry-pick of aosp/937026)

Change-Id: I8be89116bed5c4dedb2ca42b6d633aa9e8c6a49a
Merged-In: I8be89116bed5c4dedb2ca42b6d633aa9e8c6a49a
2019-05-13 22:16:50 +08:00
Benedict Wong
0d08e91fe7 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
2019-05-10 20:05:43 +00:00
Benedict Wong
fbbb9c9c04 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.
Merged-In: I545444bb483b0f5de45d00a07dc45aeb9e9cbdf7
Change-Id: I7b849ad24a04b6b7899a80f1856236b5ceb5a839
(cherry picked from commit d2465991d9)
2019-05-10 18:08:48 +00:00
Benedict Wong
817d192bc4 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
Merged-In: Ic4181fc857fa880db5553314efa914f870dbe87c
(cherry picked from commit d708a4c217f13c9028427d98031394f0933482bf)
2019-05-09 17:30:32 -07:00
Benedict Wong
2d2a1ab8f7 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
Merged-In: Icffeed2ebb2005d79faf04f48fd5126d1d6fb175
(cherry picked from commit 0e4743d56553d698ac45ae548f31019ea6e91541)
2019-05-09 17:30:32 -07:00
Benedict Wong
2742923a63 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
Merged-In: I9fdba4a905886c7a4820d86ef52c0cc1843215b2
(cherry picked from commit 2f07cd8551d755a4076e94b9e620bc446a66bf54)
2019-05-09 17:30:32 -07:00