mirror of https://github.com/ARMmbed/mbed-os.git
tests-mbed_hal-rtc_time: alocate required test data on stack
This is fix for issue 8368. Test is causing some problems on `REALTEK_RTL8195AM` and `ARM` compiler. There is some kind of memory issue. Probably there is not enough memory space for global data provided by the test. Data definitions have been moved into test function body so, they will land on stack. With this fix the test works on `REALTEK_RTL8195AM/ARM`.pull/8637/head
parent
7b8286fa3e
commit
01fee5fe49
|
@ -79,6 +79,22 @@ typedef struct {
|
||||||
bool result;
|
bool result;
|
||||||
} test_mk_time_struct;
|
} test_mk_time_struct;
|
||||||
|
|
||||||
|
/* Test boundary values for _rtc_maketime().
|
||||||
|
*
|
||||||
|
* Note: This test case is designed for both types of RTC devices:
|
||||||
|
* - RTC devices which handle correctly leap years in whole range (1970 - 2106).
|
||||||
|
* - RTC devices which does not handle correctly leap years in whole range (1970 - 2106).
|
||||||
|
* This RTC devices uses simpler leap year detection and incorrectly treat 2100 as a leap year.
|
||||||
|
* rtc_leap_year_support variable specifies which device is tested.
|
||||||
|
*
|
||||||
|
* Given is boundary calendar time.
|
||||||
|
* When _rtc_maketime() function is called to convert the calendar time into timestamp.
|
||||||
|
* Then if given calendar time is valid function returns true and conversion result, otherwise returns false.
|
||||||
|
*/
|
||||||
|
void test_mk_time_boundary()
|
||||||
|
{
|
||||||
|
test_mk_time_struct *pTestCases;
|
||||||
|
|
||||||
/* Array which contains data to test boundary values for the RTC devices which handles correctly leap years in
|
/* Array which contains data to test boundary values for the RTC devices which handles correctly leap years in
|
||||||
* whole range (1970 - 2106).
|
* whole range (1970 - 2106).
|
||||||
* Expected range: the 1st of January 1970 at 00:00:00 (seconds: 0) to the 7th of February 2106 at 06:28:15 (seconds: UINT_MAX).
|
* Expected range: the 1st of January 1970 at 00:00:00 (seconds: 0) to the 7th of February 2106 at 06:28:15 (seconds: UINT_MAX).
|
||||||
|
@ -104,22 +120,6 @@ test_mk_time_struct test_mk_time_arr_partial[] = {
|
||||||
{{ 16, 28, 6, 6, 1, 206, 0, 0, 0 }, (time_t) 0, false }, // invalid upper bound - the 6th of February 2106 at 06:28:16
|
{{ 16, 28, 6, 6, 1, 206, 0, 0, 0 }, (time_t) 0, false }, // invalid upper bound - the 6th of February 2106 at 06:28:16
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Test boundary values for _rtc_maketime().
|
|
||||||
*
|
|
||||||
* Note: This test case is designed for both types of RTC devices:
|
|
||||||
* - RTC devices which handle correctly leap years in whole range (1970 - 2106).
|
|
||||||
* - RTC devices which does not handle correctly leap years in whole range (1970 - 2106).
|
|
||||||
* This RTC devices uses simpler leap year detection and incorrectly treat 2100 as a leap year.
|
|
||||||
* rtc_leap_year_support variable specifies which device is tested.
|
|
||||||
*
|
|
||||||
* Given is boundary calendar time.
|
|
||||||
* When _rtc_maketime() function is called to convert the calendar time into timestamp.
|
|
||||||
* Then if given calendar time is valid function returns true and conversion result, otherwise returns false.
|
|
||||||
*/
|
|
||||||
void test_mk_time_boundary()
|
|
||||||
{
|
|
||||||
test_mk_time_struct *pTestCases;
|
|
||||||
|
|
||||||
/* Select array with test cases. */
|
/* Select array with test cases. */
|
||||||
if (rtc_leap_year_support == RTC_FULL_LEAP_YEAR_SUPPORT) {
|
if (rtc_leap_year_support == RTC_FULL_LEAP_YEAR_SUPPORT) {
|
||||||
pTestCases = test_mk_time_arr_full;
|
pTestCases = test_mk_time_arr_full;
|
||||||
|
|
Loading…
Reference in New Issue