From f9c25612ae3fefce8bce78433cd15cf751a86e56 Mon Sep 17 00:00:00 2001 From: Senthil Ramakrishnan Date: Sun, 20 May 2018 21:50:32 -0500 Subject: [PATCH] Fix test failures when trap errors are enabled and other fixes --- TESTS/mbed_platform/error_handling/main.cpp | 4 ++-- TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp | 6 ++++++ TESTS/mbedmicro-rtos-mbed/rtostimer/main.cpp | 5 +++++ TESTS/mbedmicro-rtos-mbed/signals/main.cpp | 5 +++++ platform/mbed_error.c | 2 +- platform/mbed_error_report.c | 2 +- 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/TESTS/mbed_platform/error_handling/main.cpp b/TESTS/mbed_platform/error_handling/main.cpp index 51bd630dfb..6acfa1fb9b 100644 --- a/TESTS/mbed_platform/error_handling/main.cpp +++ b/TESTS/mbed_platform/error_handling/main.cpp @@ -316,7 +316,7 @@ void test_error_logging() } -#define NUM_TEST_THREADS 10 +#define NUM_TEST_THREADS 5 //Error logger threads 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) { - GREENTEA_SETUP(100, "default_auto"); + GREENTEA_SETUP(300, "default_auto"); return utest::v1::verbose_test_setup_handler(number_of_cases); } diff --git a/TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp b/TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp index 7753a4521d..822c6ca789 100644 --- a/TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp @@ -51,6 +51,12 @@ Semaphore sync_sem(0, 1); void error(const char* 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 template diff --git a/TESTS/mbedmicro-rtos-mbed/rtostimer/main.cpp b/TESTS/mbedmicro-rtos-mbed/rtostimer/main.cpp index 694ea04bf3..0e29b0d091 100644 --- a/TESTS/mbedmicro-rtos-mbed/rtostimer/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/rtostimer/main.cpp @@ -85,6 +85,11 @@ void error(const char* 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 /** Test one-shot not restarted when elapsed diff --git a/TESTS/mbedmicro-rtos-mbed/signals/main.cpp b/TESTS/mbedmicro-rtos-mbed/signals/main.cpp index 0809b14f17..2e10436992 100644 --- a/TESTS/mbedmicro-rtos-mbed/signals/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/signals/main.cpp @@ -55,6 +55,11 @@ struct Sync { void error(const char* 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 diff --git a/platform/mbed_error.c b/platform/mbed_error.c index 522310f336..d5f506fbfe 100644 --- a/platform/mbed_error.c +++ b/platform/mbed_error.c @@ -163,7 +163,7 @@ mbed_error_status_t set_warning(mbed_error_status_t error_status, const char *er } //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 if( ERROR_SUCCESS != handle_error(error_status, error_msg, error_value, filename, line_number) ) diff --git a/platform/mbed_error_report.c b/platform/mbed_error_report.c index ddfe3c86e1..eed0e2158a 100644 --- a/platform/mbed_error_report.c +++ b/platform/mbed_error_report.c @@ -119,7 +119,7 @@ void mbed_error_print(char *fmtstr, uint32_t *values) while(fmtstr[i] != '\0') { if(fmtstr[i]=='%') { i++; - if(fmtstr[i]=='x' || fmtstr[i]=='d') { + if(fmtstr[i]=='x') { //print the number in hex format value_to_hex_str(values[vidx++],num_str); for(idx=7; idx>=0; idx--) {