Skip to content

Commit f9c2561

Browse files
committed
Fix test failures when trap errors are enabled and other fixes
1 parent cbfc065 commit f9c2561

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

TESTS/mbed_platform/error_handling/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void test_error_logging()
316316

317317
}
318318

319-
#define NUM_TEST_THREADS 10
319+
#define NUM_TEST_THREADS 5
320320

321321
//Error logger threads
322322
void err_thread_func(mbed_error_status_t *error_status)
@@ -471,7 +471,7 @@ void test_save_error_log()
471471

472472
utest::v1::status_t test_setup(const size_t number_of_cases)
473473
{
474-
GREENTEA_SETUP(100, "default_auto");
474+
GREENTEA_SETUP(300, "default_auto");
475475
return utest::v1::verbose_test_setup_handler(number_of_cases);
476476
}
477477

TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ Semaphore sync_sem(0, 1);
5151
void error(const char* format, ...) {
5252
(void) format;
5353
}
54+
55+
//Override the set_error function to trap the errors
56+
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)
57+
{
58+
return ERROR_SUCCESS;
59+
}
5460
#endif
5561

5662
template<uint32_t flags, uint32_t wait_ms>

TESTS/mbedmicro-rtos-mbed/rtostimer/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ void error(const char* format, ...)
8585
{
8686
(void) format;
8787
}
88+
89+
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)
90+
{
91+
return ERROR_SUCCESS;
92+
}
8893
#endif
8994

9095
/** Test one-shot not restarted when elapsed

TESTS/mbedmicro-rtos-mbed/signals/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ struct Sync {
5555
void error(const char* format, ...) {
5656
(void) format;
5757
}
58+
59+
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)
60+
{
61+
return ERROR_SUCCESS;
62+
}
5863
#endif
5964

6065

platform/mbed_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ mbed_error_status_t set_warning(mbed_error_status_t error_status, const char *er
163163
}
164164

165165
//Sets a fatal error
166-
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)
166+
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)
167167
{
168168
//set the error reported and then halt the system
169169
if( ERROR_SUCCESS != handle_error(error_status, error_msg, error_value, filename, line_number) )

platform/mbed_error_report.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void mbed_error_print(char *fmtstr, uint32_t *values)
119119
while(fmtstr[i] != '\0') {
120120
if(fmtstr[i]=='%') {
121121
i++;
122-
if(fmtstr[i]=='x' || fmtstr[i]=='d') {
122+
if(fmtstr[i]=='x') {
123123
//print the number in hex format
124124
value_to_hex_str(values[vidx++],num_str);
125125
for(idx=7; idx>=0; idx--) {

0 commit comments

Comments
 (0)