RESTRICT AUTOMERGE: Port "Exempt adb socket for hostside VpnTest" to Cts 8.1
https://android-review.googlesource.com/c/platform/cts/+/833600 Change-Id: Id6f986aacc3cadf713ebbc8305ca535b861390fc Bug: 119382723
This commit is contained in:
committed by
Ross Yeh
parent
7bd8640f4d
commit
b84038696c
3
tests/cts/hostside/app/Android.mk
Normal file → Executable file
3
tests/cts/hostside/app/Android.mk
Normal file → Executable file
@@ -19,7 +19,8 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE_TAGS := tests
|
LOCAL_MODULE_TAGS := tests
|
||||||
LOCAL_SDK_VERSION := current
|
#LOCAL_SDK_VERSION := current
|
||||||
|
LOCAL_PRIVATE_PLATFORM_APIS := true
|
||||||
LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ub-uiautomator \
|
LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ub-uiautomator \
|
||||||
CtsHostsideNetworkTestsAidl
|
CtsHostsideNetworkTestsAidl
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.net.NetworkRequest;
|
|||||||
import android.net.VpnService;
|
import android.net.VpnService;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.support.test.uiautomator.UiDevice;
|
import android.support.test.uiautomator.UiDevice;
|
||||||
import android.support.test.uiautomator.UiObject;
|
import android.support.test.uiautomator.UiObject;
|
||||||
import android.support.test.uiautomator.UiObjectNotFoundException;
|
import android.support.test.uiautomator.UiObjectNotFoundException;
|
||||||
@@ -537,6 +538,14 @@ public class VpnTest extends InstrumentationTestCase {
|
|||||||
|
|
||||||
public void testDefault() throws Exception {
|
public void testDefault() throws Exception {
|
||||||
if (!supportedHardware()) return;
|
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);
|
FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
|
||||||
|
|
||||||
@@ -554,6 +563,7 @@ public class VpnTest extends InstrumentationTestCase {
|
|||||||
|
|
||||||
FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
|
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;
|
String allowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
|
||||||
startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
|
startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
|
||||||
new String[] {"192.0.2.0/24", "2001:db8::/32"},
|
new String[] {"192.0.2.0/24", "2001:db8::/32"},
|
||||||
@@ -571,6 +581,12 @@ public class VpnTest extends InstrumentationTestCase {
|
|||||||
FileDescriptor remoteFd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
|
FileDescriptor remoteFd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
|
||||||
|
|
||||||
String disallowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
|
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"},
|
startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
|
||||||
new String[] {"192.0.2.0/24", "2001:db8::/32"},
|
new String[] {"192.0.2.0/24", "2001:db8::/32"},
|
||||||
"", disallowedApps);
|
"", disallowedApps);
|
||||||
|
|||||||
Reference in New Issue
Block a user