From: Mark Salyzyn Date: Thu, 11 Feb 2016 23:04:35 +0000 (-0800) Subject: rtc_time: test agent timeouts X-Git-Tag: android-x86-7.1-r1~83 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2b2efb53fa6b0f8cb3e41d13c665d88181a5cd4e;p=android-x86%2Fsystem-extras.git rtc_time: test agent timeouts (cherry pick from commit 9258225ece5d6816ddf9a45e45fb694142c32761) Break the test up into four, keeping each well below the 60 second timeout for the test agents. Overhead for the splitting up is an additional 10 seconds in order to complete all four of the tests instead of one. typical single test completion is 22.5 seconds. Change-Id: If8e9a6c7dfd505a9fbc73e9248be4eb2b61521e5 --- diff --git a/tests/timetest/rtc_test.cpp b/tests/timetest/rtc_test.cpp index d1c9eafc..26ca13ad 100644 --- a/tests/timetest/rtc_test.cpp +++ b/tests/timetest/rtc_test.cpp @@ -77,7 +77,7 @@ static int set_hwtime(struct rtc_time *tm) { return hwtime(O_WRONLY, RTC_SET_TIME, tm); } -TEST(time, rtc_rollover) { +static void rtc_rollover(int start, int end) { struct rtc_time roll; memset(&roll, 0, sizeof(roll)); ASSERT_LE(0, rd_hwtime(&roll)); @@ -118,7 +118,7 @@ TEST(time, rtc_rollover) { roll.tm_isdst = 0; bool eacces = true; - for (roll.tm_year = 70; roll.tm_year < 137; ++roll.tm_year) { + for (roll.tm_year = start; roll.tm_year < end; ++roll.tm_year) { struct rtc_time tm = roll; int __set_hwtime = set_hwtime(&tm); // Allowed to be 100% denied for writing @@ -126,8 +126,8 @@ TEST(time, rtc_rollover) { continue; } eacces = false; - // below 2015, permitted to error out. - if ((__set_hwtime == -EINVAL) && (roll.tm_year < 115)) { + // below 2016, permitted to error out. + if ((__set_hwtime == -EINVAL) && (roll.tm_year < 116)) { continue; } ASSERT_LE(0, __set_hwtime); @@ -180,3 +180,19 @@ TEST(time, rtc_rollover) { ASSERT_EQ(save.tm_year, roll.tm_year); } } + +TEST(time, rtc_rollover_1970_1990) { + rtc_rollover(70, 90); +} + +TEST(time, rtc_rollover_1990_2010) { + rtc_rollover(90, 110); +} + +TEST(time, rtc_rollover_2010_2030) { + rtc_rollover(110, 130); +} + +TEST(time, rtc_rollover_2030_2037) { + rtc_rollover(130, 137); +}