mirror of https://github.com/ARMmbed/mbed-os.git
Test: Watchdog: Fix test_restart case
Watchdog::stop() is called in this test. If the target does not support stopping the watchdog this case needs to be skipped. Also improve handling ignored test cases.pull/10857/head
parent
dc2e8ab35e
commit
b89eeb7ec5
|
@ -60,6 +60,7 @@
|
|||
|
||||
int CASE_INDEX_START;
|
||||
int CASE_INDEX_CURRENT;
|
||||
bool CASE_IGNORED = false;
|
||||
|
||||
using utest::v1::Case;
|
||||
using utest::v1::Specification;
|
||||
|
@ -91,6 +92,7 @@ void test_stop()
|
|||
Watchdog &watchdog = Watchdog::get_instance();
|
||||
if (!features.disable_watchdog) {
|
||||
TEST_ASSERT_FALSE(watchdog.stop());
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Disabling watchdog not supported for this platform");
|
||||
return;
|
||||
}
|
||||
|
@ -114,9 +116,15 @@ void test_restart()
|
|||
{
|
||||
watchdog_features_t features = hal_watchdog_get_platform_features();
|
||||
if (!features.update_config) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Updating watchdog config not supported for this platform");
|
||||
return;
|
||||
}
|
||||
if (!features.disable_watchdog) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Disabling watchdog not supported for this platform");
|
||||
return;
|
||||
}
|
||||
|
||||
Watchdog &watchdog = Watchdog::get_instance();
|
||||
uint32_t max_timeout = watchdog.get_max_timeout();
|
||||
|
@ -129,6 +137,7 @@ void test_restart()
|
|||
|
||||
for (size_t i = 0; i < num_timeouts; i++) {
|
||||
if (timeouts[i] < WDG_MIN_TIMEOUT_MS) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Requested timeout value is too short -- ignoring test case.");
|
||||
return;
|
||||
}
|
||||
|
@ -148,12 +157,16 @@ void test_restart()
|
|||
utest::v1::status_t case_setup_sync_on_reset(const Case *const source, const size_t index_of_case)
|
||||
{
|
||||
CASE_INDEX_CURRENT = index_of_case;
|
||||
CASE_IGNORED = false;
|
||||
return utest::v1::greentea_case_setup_handler(source, index_of_case);
|
||||
}
|
||||
|
||||
utest::v1::status_t case_teardown_sync_on_reset(const Case *const source, const size_t passed, const size_t failed,
|
||||
const utest::v1::failure_t failure)
|
||||
{
|
||||
if (CASE_IGNORED) {
|
||||
return utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
|
||||
}
|
||||
// Unlock kicking the watchdog during teardown.
|
||||
kick_wdg_during_test_teardown.release();
|
||||
utest::v1::status_t status = utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
|
||||
|
@ -178,6 +191,9 @@ utest::v1::status_t case_teardown_sync_on_reset(const Case *const source, const
|
|||
utest::v1::status_t case_teardown_wdg_stop_or_reset(const Case *const source, const size_t passed, const size_t failed,
|
||||
const utest::v1::failure_t failure)
|
||||
{
|
||||
if (CASE_IGNORED) {
|
||||
return utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
|
||||
}
|
||||
watchdog_features_t features = hal_watchdog_get_platform_features();
|
||||
if (features.disable_watchdog) {
|
||||
hal_watchdog_stop();
|
||||
|
@ -191,6 +207,7 @@ template<uint32_t timeout_ms>
|
|||
void test_start()
|
||||
{
|
||||
if (timeout_ms < WDG_MIN_TIMEOUT_MS) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Requested timeout value is too short -- ignoring test case.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
|
||||
int CASE_INDEX_START;
|
||||
int CASE_INDEX_CURRENT;
|
||||
bool CASE_IGNORED = false;
|
||||
|
||||
using utest::v1::Case;
|
||||
using utest::v1::Specification;
|
||||
|
@ -89,6 +90,7 @@ void test_restart_is_possible()
|
|||
{
|
||||
watchdog_features_t features = hal_watchdog_get_platform_features();
|
||||
if (!features.disable_watchdog) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Disabling watchdog not supported for this platform");
|
||||
return;
|
||||
}
|
||||
|
@ -100,6 +102,7 @@ void test_stop()
|
|||
watchdog_features_t features = hal_watchdog_get_platform_features();
|
||||
if (!features.disable_watchdog) {
|
||||
TEST_ASSERT_EQUAL(WATCHDOG_STATUS_NOT_SUPPORTED, hal_watchdog_stop());
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Disabling watchdog not supported for this platform");
|
||||
return;
|
||||
}
|
||||
|
@ -118,6 +121,7 @@ void test_update_config()
|
|||
{
|
||||
watchdog_features_t features = hal_watchdog_get_platform_features();
|
||||
if (!features.update_config) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Updating watchdog config not supported for this platform");
|
||||
return;
|
||||
}
|
||||
|
@ -132,6 +136,7 @@ void test_update_config()
|
|||
|
||||
for (size_t i = 0; i < num_timeouts; i++) {
|
||||
if (timeouts[i] < WDG_MIN_TIMEOUT_MS) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Requested timeout value is too short -- ignoring test case.");
|
||||
return;
|
||||
}
|
||||
|
@ -149,12 +154,16 @@ void test_update_config()
|
|||
utest::v1::status_t case_setup_sync_on_reset(const Case *const source, const size_t index_of_case)
|
||||
{
|
||||
CASE_INDEX_CURRENT = index_of_case;
|
||||
CASE_IGNORED = false;
|
||||
return utest::v1::greentea_case_setup_handler(source, index_of_case);
|
||||
}
|
||||
|
||||
utest::v1::status_t case_teardown_sync_on_reset(const Case *const source, const size_t passed, const size_t failed,
|
||||
const utest::v1::failure_t failure)
|
||||
{
|
||||
if (CASE_IGNORED) {
|
||||
return utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
|
||||
}
|
||||
// Unlock kicking the watchdog during teardown.
|
||||
kick_wdg_during_test_teardown.release();
|
||||
utest::v1::status_t status = utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
|
||||
|
@ -179,6 +188,9 @@ utest::v1::status_t case_teardown_sync_on_reset(const Case *const source, const
|
|||
utest::v1::status_t case_teardown_wdg_stop_or_reset(const Case *const source, const size_t passed, const size_t failed,
|
||||
const utest::v1::failure_t failure)
|
||||
{
|
||||
if (CASE_IGNORED) {
|
||||
return utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
|
||||
}
|
||||
watchdog_features_t features = hal_watchdog_get_platform_features();
|
||||
if (features.disable_watchdog) {
|
||||
hal_watchdog_stop();
|
||||
|
@ -192,6 +204,7 @@ template<uint32_t timeout_ms>
|
|||
void test_init()
|
||||
{
|
||||
if (timeout_ms < WDG_MIN_TIMEOUT_MS) {
|
||||
CASE_IGNORED = true;
|
||||
TEST_IGNORE_MESSAGE("Requested timeout value is too short -- ignoring test case.");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue