summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-02-11 15:04:35 -0800
committerMark Salyzyn <salyzyn@google.com>2016-02-11 23:36:29 +0000
commit9258225ece5d6816ddf9a45e45fb694142c32761 (patch)
tree7ecefa05653a982bd099c904d8c6a3be310d6c86
parentec255673dc853bcf9a829ea0f476d4fd2f1d4a67 (diff)
downloadextras-9258225ece5d6816ddf9a45e45fb694142c32761.tar.gz
rtc_time: test agent timeouts
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
-rw-r--r--tests/timetest/rtc_test.cpp24
1 files changed, 20 insertions, 4 deletions
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);
+}