summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-07-25 20:00:27 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-07-25 20:00:27 +0000
commit873f2d8aa3907c56ac2b5d61985173158f2c1957 (patch)
tree109b92f028c3ef1547ab848b207aa5c4a4b3c841
parent27764a59cb20b05fc32f038d0ad276760c3517ab (diff)
parent1cd060bc1e5574bafa9b124e06923d9d43179e30 (diff)
downloadcts-873f2d8aa3907c56ac2b5d61985173158f2c1957.tar.gz
Merge "Exempt adb socket for hostside VpnTest" into nougat-cts-dev
-rw-r--r--hostsidetests/net/app/Android.mk5
-rwxr-xr-xhostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java16
2 files changed, 20 insertions, 1 deletions
diff --git a/hostsidetests/net/app/Android.mk b/hostsidetests/net/app/Android.mk
index 9519ec5242f..443ea71b1cc 100644
--- a/hostsidetests/net/app/Android.mk
+++ b/hostsidetests/net/app/Android.mk
@@ -19,10 +19,13 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
+#LOCAL_SDK_VERSION := current
+LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceutil ctstestrunner ub-uiautomator \
CtsHostsideNetworkTestsAidl
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsHostsideNetworkTestsApp
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
index 12fe625370b..9635b28031e 100755
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
@@ -29,6 +29,7 @@ import android.net.NetworkRequest;
import android.net.VpnService;
import android.os.ParcelFileDescriptor;
import android.os.Process;
+import android.os.SystemProperties;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
@@ -525,6 +526,14 @@ public class VpnTest extends InstrumentationTestCase {
public void testDefault() throws Exception {
if (!supportedHardware()) return;
+ // If adb TCP port opened, this test may running by adb over network.
+ // All of socket would be destroyed in this test. So this test don't
+ // support adb over network, see b/119382723.
+ if (SystemProperties.getInt("persist.adb.tcp.port", -1) > -1
+ || SystemProperties.getInt("service.adb.tcp.port", -1) > -1) {
+ Log.i(TAG, "adb is running over the network, so skip this test");
+ return;
+ }
FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
@@ -542,6 +551,7 @@ public class VpnTest extends InstrumentationTestCase {
FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
+ // Shell app must not be put in here or it would kill the ADB-over-network use case
String allowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
new String[] {"192.0.2.0/24", "2001:db8::/32"},
@@ -559,6 +569,12 @@ public class VpnTest extends InstrumentationTestCase {
FileDescriptor remoteFd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
String disallowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
+ // If adb TCP port opened, this test may running by adb over TCP.
+ // Add com.android.shell appllication into blacklist to exclude adb socket for VPN test,
+ // see b/119382723.
+ // Note: The test don't support running adb over network for root device
+ disallowedApps = disallowedApps + ",com.android.shell";
+ Log.i(TAG, "Append shell app to disallowedApps: " + disallowedApps);
startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
new String[] {"192.0.2.0/24", "2001:db8::/32"},
"", disallowedApps);