标签:失败 tst oid dstat grep oba force cte could
1.run gts -m GtsTetheringTestCases -t com.google.android.tethering.gts.ProvisioningTest#testRunSilentWifiTetherProvisioningAndEnable?
日志报错:
01-24 10:06:09 I/ModuleListener: [1/1] com.google.android.tethering.gts.ProvisioningTest#testRunSilentWifiTetherProvisioningAndEnable fail:
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:48)
at junit.framework.Assert.assertTrue(Assert.java:20)
at junit.framework.Assert.assertTrue(Assert.java:27)
at com.google.android.tethering.gts.ProvisioningTest.ensureWifiApOff(ProvisioningTest.java:132)
at com.google.android.tethering.gts.ProvisioningTest.setUp(ProvisioningTest.java:108)
at junit.framework.TestCase.runBare(TestCase.java:132)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at android.support.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:73)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:51)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:62)
at android.support.test.internal.runner.junit3.AndroidTestSuite$2.run(AndroidTestSuite.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
通过查看gts测试源码,测试方法是testRunSilentWifiTetherProvisioningAndEnable?()
为何报错是在不相关的兄弟方法
ensureWifiApOff(ProvisioningTest.java:132)
setUp(ProvisioningTest.java:108)
按照报错去查看原因,找到报错是因为没有请求到期望的state---WIFI_AP_STATE_DISABLED = 11;
源码追溯:
com.google.android.tethering.gts.ProvisioningTest.java
private static final int WIFI_AP_TIMEOUT = 15000;
***************************************************************************
/**
* Wi-Fi AP is disabled.
*
* @see #WIFI_AP_STATE_CHANGED_ACTION
* @see #getWifiState()
*
* @hide
*/
@SystemApi
public static final int WIFI_AP_STATE_DISABLED = 11;
***************************************************************************
private void ensureWifiApOff() {
if (this.mWifiManager.getWifiApState() != 11) {
this.mConnectivityManager.stopTethering(0);
assertTrue(waitForWifiApState(11, WIFI_AP_TIMEOUT));
}
}
***************************************************************************
private boolean waitForWifiApState(int expectedState, int timeout) {
long startTime = SystemClock.uptimeMillis();
while (this.mWifiManager.getWifiApState() != expectedState) {
if (SystemClock.uptimeMillis() - startTime > ((long) timeout)) {
Log.v(TAG, String.format("waitForWifiAPState timeout: expected=%d, actual=%d", new Object[]{Integer.valueOf(expectedState), Integer.valueOf(state)}));
return false;
}
SystemClock.sleep(1000);
}
return true;
}
2.run gts -m GtsTetheringTestCases -t com.google.android.tethering.gts.ProvisioningTest#testRunUiBluetoothTetherProvisioningAndEnable?
通过查看gts测试源码得知,进行该项测试,需要判断(是否支持共享)---->>isTetheringSupported();
该方法通过读属性"ro.tether.denied"获取结果,
我们的盒子中没有"ro.tether.denied"属性,只有
console:/ # getprop | grep tether
[net.tethering.noprovisioning]: [true]
shouldRunTest()
方法判断读到的属性,应该是ro.tether.denied = 否
,才能开启测试,
但是我们的属性[net.tethering.noprovisioning]: [true]
考虑:
我们要改一下属性[net.tethering.noprovisioning]
属性的值?
还是添加新的属性[ro.tether.denied]
源码追溯:
com.google.android.tethering.gts.ProvisioningTest.java
private void runBluetoothTest(boolean showProvisioningUi) throws Exception {
if (shouldRunTest() && isBluetoothTetheringSupported()) {
boolean adapterWasDisabled = false;
if (!this.mBluetoothAdapter.isEnabled()) {
Log.v(TAG, "Enabling bluetooth for tethering");
adapterWasDisabled = true;
this.mBluetoothAdapter.enable();
waitForBluetoothState(12);
}
this.mConnectivityManager.startTethering(2, showProvisioningUi, this.mCallback);
assertTrue(waitForSuccessCallback());
assertTrue(waitForBluetoothTetherState(true));
if (adapterWasDisabled) {
this.mBluetoothAdapter.disable();
waitForBluetoothState(10);
}
}
}
private boolean shouldRunTest() {
PackageManager packageManager = this.mContext.getPackageManager();
try {
if (packageManager.getApplicationInfo(PACKAGE_GMS_CORE, 128) != null && packageManager.hasSystemFeature("android.hardware.wifi") && this.mConnectivityManager.isTetheringSupported()) {
return ApiLevelUtil.isAtLeast(24);
}
return false;
} catch (NameNotFoundException e) {
return false;
}
}
ConnectivityService.java
// if ro.tether.denied = true we default to no tethering
// gservices could set the secure setting to 1 though to enable it on a build where it
// had previously been turned off.
public boolean isTetheringSupported() {
enforceTetherAccessPermission();
int defaultVal = (SystemProperties.get("ro.tether.denied").equals("true") ? 0 : 1);
boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.TETHER_SUPPORTED, defaultVal) != 0);
return tetherEnabledInSettings && mTetheringConfigValid;
}
3.run gts -m GtsTetheringTestCases -t com.google.android.tethering.gts.ProvisioningTest#testRunUiWifiTetherProvisioningAndEnable?
没有获取到期望的state---waitForWifiApState(13, PROVISION_TIMEOUT)
源码追溯:
com.google.android.tethering.gts.ProvisioningTest.java
/**
* Wi-Fi AP is enabled.
*
* @see #WIFI_AP_STATE_CHANGED_ACTION
* @see #getWifiApState()
*
* @hide
*/
@SystemApi
public static final int WIFI_AP_STATE_ENABLED = 13;
private void runWifiApTest(boolean showProvisioningUi) {
if (shouldRunTest()) {
this.mConnectivityManager.startTethering(0, showProvisioningUi, this.mCallback);
assertTrue(waitForWifiApState(13, PROVISION_TIMEOUT));
assertTrue(waitForSuccessCallback());
}
}
4.run gts -m GtsTetheringTestCases -t com.google.android.tethering.gts.ProvisioningTest#testSilentInvalidTetherTypeTest?
报的错同第一条失败项
日志报错:
01-24 15:16:49 I/ModuleListener: [1/1] com.google.android.tethering.gts.ProvisioningTest#testSilentInvalidTetherTypeTest fail:
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:48)
at junit.framework.Assert.assertTrue(Assert.java:20)
at junit.framework.Assert.assertTrue(Assert.java:27)
at com.google.android.tethering.gts.ProvisioningTest.ensureWifiApOff(ProvisioningTest.java:132)
at com.google.android.tethering.gts.ProvisioningTest.setUp(ProvisioningTest.java:108)
at junit.framework.TestCase.runBare(TestCase.java:132)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at android.support.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:73)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:51)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:62)
at android.support.test.internal.runner.junit3.AndroidTestSuite$2.run(AndroidTestSuite.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
GTS—-关于GtsTetheringTestCases模块的几个失败项
标签:失败 tst oid dstat grep oba force cte could
原文地址:https://www.cnblogs.com/houser0323/p/10988986.html