Fix test failures when trap errors are enabled and other fixes

pull/6983/head
Senthil Ramakrishnan 2018-05-20 21:50:32 -05:00
parent cbfc06577b
commit f9c25612ae
6 changed files with 20 additions and 4 deletions

View File

@ -316,7 +316,7 @@ void test_error_logging()
} }
#define NUM_TEST_THREADS 10 #define NUM_TEST_THREADS 5
//Error logger threads //Error logger threads
void err_thread_func(mbed_error_status_t *error_status) void err_thread_func(mbed_error_status_t *error_status)
@ -471,7 +471,7 @@ void test_save_error_log()
utest::v1::status_t test_setup(const size_t number_of_cases) utest::v1::status_t test_setup(const size_t number_of_cases)
{ {
GREENTEA_SETUP(100, "default_auto"); GREENTEA_SETUP(300, "default_auto");
return utest::v1::verbose_test_setup_handler(number_of_cases); return utest::v1::verbose_test_setup_handler(number_of_cases);
} }

View File

@ -51,6 +51,12 @@ Semaphore sync_sem(0, 1);
void error(const char* format, ...) { void error(const char* format, ...) {
(void) format; (void) format;
} }
//Override the set_error function to trap the errors
mbed_error_status_t set_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{
return ERROR_SUCCESS;
}
#endif #endif
template<uint32_t flags, uint32_t wait_ms> template<uint32_t flags, uint32_t wait_ms>

View File

@ -85,6 +85,11 @@ void error(const char* format, ...)
{ {
(void) format; (void) format;
} }
mbed_error_status_t set_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{
return ERROR_SUCCESS;
}
#endif #endif
/** Test one-shot not restarted when elapsed /** Test one-shot not restarted when elapsed

View File

@ -55,6 +55,11 @@ struct Sync {
void error(const char* format, ...) { void error(const char* format, ...) {
(void) format; (void) format;
} }
mbed_error_status_t set_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{
return ERROR_SUCCESS;
}
#endif #endif

View File

@ -163,7 +163,7 @@ mbed_error_status_t set_warning(mbed_error_status_t error_status, const char *er
} }
//Sets a fatal error //Sets a fatal error
mbed_error_status_t set_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number) WEAK mbed_error_status_t set_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{ {
//set the error reported and then halt the system //set the error reported and then halt the system
if( ERROR_SUCCESS != handle_error(error_status, error_msg, error_value, filename, line_number) ) if( ERROR_SUCCESS != handle_error(error_status, error_msg, error_value, filename, line_number) )

View File

@ -119,7 +119,7 @@ void mbed_error_print(char *fmtstr, uint32_t *values)
while(fmtstr[i] != '\0') { while(fmtstr[i] != '\0') {
if(fmtstr[i]=='%') { if(fmtstr[i]=='%') {
i++; i++;
if(fmtstr[i]=='x' || fmtstr[i]=='d') { if(fmtstr[i]=='x') {
//print the number in hex format //print the number in hex format
value_to_hex_str(values[vidx++],num_str); value_to_hex_str(values[vidx++],num_str);
for(idx=7; idx>=0; idx--) { for(idx=7; idx>=0; idx--) {