-
Notifications
You must be signed in to change notification settings - Fork 1.1k
common-io: Refactoring and updates to RTC test cases and top-level header file #1977
Conversation
xSetDateTime.usYear = testIotRTC_DEFAULT_CURRENT_YEAR; | ||
xSetDateTime.ucMonth = testIotRTC_DEFAULT_CURRENT_MONTH; | ||
xSetDateTime.ucDay = testIotRTC_DEFAULT_CURRENT_DAY; | ||
xSetDateTime.ucHour = testIotRTC_DEFAULT_CURRENT_HOUR; | ||
xSetDateTime.ucMinute = testIotRTC_DEFAULT_CURRENT_MINUTE; | ||
xSetDateTime.ucSecond = testIotRTC_DEFAULT_CURRENT_SECOND; | ||
xSetDateTime.ucSecond = testIotRTC_DEFAULT_CURRENT_SECOND + testIotRTC_DEFAULT_ALARM_TIME; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the DEFAULT_ALARM_TIME added here to the default time being set? #722 may not return error if its the current second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is due to the fact that testIotRTC_DEFAULT_CURRENT_SECOND is zero. The original setup would subtract 5 from 0 in a uint8 causing a underflow. That said, it could be a good idea to bump it so that xSetDateTime.ucSecond > testIotRTC_DEFAULT_ALARM_TIME.
You agree with bumping it to say 2 * testIotRTC_DEFAULT_ALARM_TIME? Alternatively, set testIotRTC_DEFAULT_CURRENT_SECOND > testIotRTC_DEFAULT_ALARM_TIME.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Didnt realize that. I agree to either of the approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
/bot run checks |
cab6b7a
to
571f87a
Compare
/bot run checks |
…on how the test was setup. Refactored tests to use TEST_PROTECT sections, init all values of the date/time struct and not having 'eternal block' on semaphores
…RtcSetAlarmInvalid test-case as it needs to setup alarm ni the past.
571f87a
to
d4bfe4f
Compare
/bot run checks |
1 similar comment
/bot run checks |
…ader file (aws#1977) * Updated iot_rtc.h documentation to cover expected return value based on how the test was setup. Refactored tests to use TEST_PROTECT sections, init all values of the date/time struct and not having 'eternal block' on semaphores * Changed default seconds value from 0 to 10 to better fit the AFQP_IotRtcSetAlarmInvalid test-case as it needs to setup alarm ni the past. Co-authored-by: Max Wennerfeldt <[email protected]>
Description
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.