Disable mbed semihosting interface in tests, so as not to mess up their timing

pull/15339/head
Jamie Smith 2022-07-13 09:00:31 -07:00 committed by Jay Sridharan
parent 222bf9730e
commit b93af1b95c
5 changed files with 32 additions and 0 deletions

View File

@ -227,6 +227,12 @@ utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
#endif
ticker_suspend(get_us_ticker_data());
#ifdef DEVICE_SEMIHOST
// Disconnect semihosting now, because otherwise it will get disconnected on the first sleep call and
// cause said call to take several milliseconds, leading to a test failure.
mbed_interface_disconnect();
#endif
us_ticker_init();
#if DEVICE_LPTICKER
lp_ticker_init();

View File

@ -675,6 +675,13 @@ Case cases[] = {
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(20, "default_auto");
#ifdef DEVICE_SEMIHOST
// Disconnect semihosting now, because otherwise it will get disconnected on the first sleep call and
// cause said call to take several milliseconds, leading to a test failure.
mbed_interface_disconnect();
#endif
return greentea_test_setup_handler(number_of_cases);
}

View File

@ -478,6 +478,13 @@ void test_mail_full()
utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10, "default_auto");
#ifdef DEVICE_SEMIHOST
// Disconnect semihosting now, because otherwise it will get disconnected on the first sleep call and
// cause said call to take several milliseconds, leading to a test failure.
mbed_interface_disconnect();
#endif
return verbose_test_setup_handler(number_of_cases);
}

View File

@ -318,6 +318,13 @@ void test_queue_full()
utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(5, "default_auto");
#ifdef DEVICE_SEMIHOST
// Disconnect semihosting now, because otherwise it will get disconnected on the first sleep call and
// cause said call to take several milliseconds, leading to a test failure.
mbed_interface_disconnect();
#endif
return verbose_test_setup_handler(number_of_cases);
}

View File

@ -26,8 +26,13 @@ set(MBED_RESET_BAUDRATE 115200)
# Config options for OPENOCD
# -------------------------------------------------------------
# One note about OpenOCD for LPC1768:
# If you issue a "monitor reset" command, GDB will think that the program is halted, but it actually will have
# resumed. So, issue a "c" command after "monitor reset" to get things synchronized again.
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/lpc1768.cfg
-c "gdb_memory_map disable" # prevents OpenOCD crash on GDB connect
-c "gdb_breakpoint_override hard" # Make sure GDB uses HW breakpoints
)