GTS—-关于GtsTetheringTestCases模块的几个失败项
Posted houser0323
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GTS—-关于GtsTetheringTestCases模块的几个失败项相关的知识,希望对你有一定的参考价值。
GTS---关于GtsTetheringTestCases模块的几个失败项
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"获取结果,
问题点1:
我们的盒子中没有"ro.tether.denied"属性,只有
console:/ # getprop | grep tether
[net.tethering.noprovisioning]: [true]
问题点2:
shouldRunTest()
方法判断读到的属性,应该是ro.tether.denied = 否
,才能开启测试,
但是我们的属性[net.tethering.noprovisioning]: [true]
问题点3:
考虑:
我们要改一下属性[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模块的几个失败项的主要内容,如果未能解决你的问题,请参考以下文章
GTS-FailGtsSecurityHostTestCases#testNoExemptionsForSocketsBetweenCoreAndVendorBan
Intel® HD Graphics 610核显和gts450哪个好? gts450显卡怎么样?
GTS GtsSpeechServicesTestCases 模块 testEEADevicesHaveCorrectPackages fail 解决方法