本文主要是介绍cts测试用例 test_getInstance_invalid_locale 失败原因及解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
cts测试中,测试test_getInstance_invalid_locale失败的详细log如下:
cts-tf > run cts -c libcore.java.text.DateFormatSymbolsTest -m test_getInstance_invalid_locale
03-01 12:12:23 I/TestInvocation: Starting invocation for 'cts' on build '4.0_r1' on device
XXXXX
03-01 12:12:23 I/XXXXX: Created result dir 2013.03.01_12.12.23
cts-tf > 03-01 12:12:59 I/XXXXX: Collecting device info
03-01 12:13:01 I/XXXXX: -----------------------------------------
03-01 12:13:01 I/XXXXX: Test package android.core.tests.libcore.package.libcore started
03-01 12:13:01 I/XXXXX: -----------------------------------------
03-01 12:13:30 I/XXXXX: libcore.java.text.DateFormatSymbolsTest#test_getInstance_invalid_locale FAIL
junit.framework.AssertionFailedError: expected:<java.text.DateFormatSymbols[amPmStrings=[AM, PM],customZoneStrings=false,eras=[BCE, CE],localPatternChars=GyMdkHmsSEDFwWahKzZLc,months=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ],shortMonths=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ],shortWeekdays=[, 1, 2, 3, 4, 5, 6, 7],weekdays=[, 1, 2, 3, 4, 5, 6, 7],zoneStrings=[[Africa/Abidjan, GMT+00:00, GMT, GMT+00:00, GMT]...]]> but was:<java.text.DateFormatSymbols[amPmStrings=[AM, PM],customZoneStrings=false,eras=[BCE, CE],localPatternChars=GyMdkHmsSEDFwWahKzZLc,months=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ],shortMonths=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ],shortWeekdays=[, 1, 2, 3, 4, 5, 6, 7],weekdays=[, 1, 2, 3, 4, 5, 6, 7],zoneStrings=[[Africa/Abidjan, GMT+00:00, GMT, GMT+00:00, GMT]...]]>
at libcore.java.text.DateFormatSymbolsTest.assertLocaleIsEquivalentToRoot(DateFormatSymbolsTest.java:34)
at libcore.java.text.DateFormatSymbolsTest.test_getInstance_invalid_locale(DateFormatSymbolsTest.java:45)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
03-01 12:13:35 I/XXXXX: Saved log device_logcat_8630206044834590717.zip
03-01 12:13:35 I/XXXXX: Saved log host_log_8882157295501951768.zip
03-01 12:13:35 I/XXXXX: android.core.tests.libcore.package.libcore package complete: Passed 0, Failed 1, Not Executed 0
03-01 12:13:35 I/XXXXX: Created xml report file at file:///home/xxx/android-cts/repository/results/2013.03.01_12.12.23/testResult.xml
03-01 12:13:35 I/XXXXX: XML test result file generated at 2013.03.01_12.12.23. Passed 0, Failed 1, Not Executed 0
03-01 12:13:35 I/XXXXX: Time: 1m 12s
失败原因:更改日期后没有重启机器(只更改日和月不用重启,更改年份一定要重启机器)
解决办法:更改日期(年份)后要重新启动机器
有些机器设置了自动更新日期和时间,如果自动更新时改动了年份,则需要重启机器,否则该项测试会失败。有些机器没有rtc供电电池,彻底断电后rtc停止工作,这样再次开机时自动重设时间。建议将rtc初始化的日期设置到当前年份。
rtc初始化代码在kernel/drivers/rtc/rtc-xxx.c
/* Default time for the first-time power on */
static struct rtc_time default_tm = {
.tm_year = (2013 - 1900), // year 2013
.tm_mon = (3 - 1), // month 3
.tm_mday = 1, // day 1
.tm_hour = 12,
.tm_min = 0,
.tm_sec = 0
};
这篇关于cts测试用例 test_getInstance_invalid_locale 失败原因及解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!