Skip to content

Commit 850a3b3

Browse files
committed
drivers: tests: rtc: harden alarm tests
Ensure the alarm tests exercise rollover scenarios by setting RTC time to a few seconds before midnight on a December 31st and alarm time to a few seconds after midnight on the following day. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent 6acb085 commit 850a3b3

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

tests/drivers/rtc/rtc_api/src/test_alarm.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,30 @@ static const struct device *rtc = DEVICE_DT_GET(DT_ALIAS(rtc));
1818
static const uint16_t alarms_count = DT_PROP(DT_ALIAS(rtc), alarms_count);
1919
static const uint16_t test_alarm_time_mask_set = CONFIG_TEST_RTC_ALARM_TIME_MASK;
2020

21-
/* Fri Jan 01 2021 13:29:50 GMT+0000 */
21+
/* Tue Dec 31 2024 23:59:55 GMT+0000 */
2222
static const struct rtc_time test_rtc_time_set = {
23-
.tm_sec = 50,
24-
.tm_min = 29,
25-
.tm_hour = 13,
26-
.tm_mday = 1,
27-
.tm_mon = 0,
28-
.tm_year = 121,
29-
.tm_wday = 5,
30-
.tm_yday = 1,
23+
.tm_sec = 55,
24+
.tm_min = 59,
25+
.tm_hour = 23,
26+
.tm_mday = 31,
27+
.tm_mon = 11,
28+
.tm_year = 124,
29+
.tm_wday = 2,
30+
.tm_yday = 365,
3131
.tm_isdst = -1,
3232
.tm_nsec = 0,
3333
};
3434

35-
/* Fri Jan 01 2021 13:30:00 GMT+0000 */
35+
/* Wed Jan 01 2025 00:00:05 GMT+0000 */
3636
static const struct rtc_time test_alarm_time_set = {
37-
.tm_sec = 0,
38-
.tm_min = 30,
39-
.tm_hour = 13,
37+
.tm_sec = 5,
38+
.tm_min = 0,
39+
.tm_hour = 0,
4040
.tm_mday = 1,
4141
.tm_mon = 0,
42-
.tm_year = 121,
43-
.tm_wday = 5,
44-
.tm_yday = 1,
42+
.tm_year = 125,
43+
.tm_wday = 3,
44+
.tm_yday = 0,
4545
.tm_isdst = -1,
4646
.tm_nsec = 0,
4747
};

tests/drivers/rtc/rtc_api/src/test_alarm_callback.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ static atomic_t callback_called_mask_even;
2222

2323
static const uint16_t test_alarm_time_mask_set = CONFIG_TEST_RTC_ALARM_TIME_MASK;
2424

25-
/* Fri Jan 01 2021 13:29:50 GMT+0000 */
25+
/* Tue Dec 31 2024 23:59:55 GMT+0000 */
2626
static const struct rtc_time test_rtc_time_set = {
27-
.tm_sec = 50,
28-
.tm_min = 29,
29-
.tm_hour = 13,
30-
.tm_mday = 1,
31-
.tm_mon = 0,
32-
.tm_year = 121,
33-
.tm_wday = 5,
34-
.tm_yday = 1,
27+
.tm_sec = 55,
28+
.tm_min = 59,
29+
.tm_hour = 23,
30+
.tm_mday = 31,
31+
.tm_mon = 11,
32+
.tm_year = 124,
33+
.tm_wday = 2,
34+
.tm_yday = 365,
3535
.tm_isdst = -1,
3636
.tm_nsec = 0,
3737
};
3838

39-
/* Fri Jan 01 2021 13:30:00 GMT+0000 */
39+
/* Wed Jan 01 2025 00:00:05 GMT+0000 */
4040
static const struct rtc_time test_alarm_time_set = {
41-
.tm_sec = 0,
42-
.tm_min = 30,
43-
.tm_hour = 13,
41+
.tm_sec = 5,
42+
.tm_min = 0,
43+
.tm_hour = 0,
4444
.tm_mday = 1,
4545
.tm_mon = 0,
46-
.tm_year = 121,
47-
.tm_wday = 5,
48-
.tm_yday = 1,
46+
.tm_year = 125,
47+
.tm_wday = 3,
48+
.tm_yday = 0,
4949
.tm_isdst = -1,
5050
.tm_nsec = 0,
5151
};

0 commit comments

Comments
 (0)