From 5a052a523a98a07025befb17269ab37644c48c94 Mon Sep 17 00:00:00 2001 From: Niklas Hauser Date: Tue, 22 Dec 2015 18:08:20 +0000 Subject: [PATCH] Fixed premature validation attribute modification. --- "frameworks\\utest/source/harness.cpp" | 11 +++++++---- "frameworks\\utest/utest/types.h" | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git "a/frameworks\\utest/source/harness.cpp" "b/frameworks\\utest/source/harness.cpp" index f24c9c8811..521e809e16 100644 --- "a/frameworks\\utest/source/harness.cpp" +++ "b/frameworks\\utest/source/harness.cpp" @@ -183,6 +183,7 @@ void Harness::validate_callback(const control_t control) case_timeout_handle = NULL; control_t merged_control = case_control + control; case_control.repeat = repeat_t(merged_control.repeat & ~REPEAT_ON_TIMEOUT); + case_control.timeout = TIMEOUT_NONE; minar::Scheduler::postCallback(schedule_next_case); } } @@ -210,14 +211,16 @@ void Harness::run_next_case() return; } + repeat_t setup_repeat; { mbed::util::CriticalSectionLock lock; case_validation_count = 0; case_timeout_occurred = false; + setup_repeat = case_control.repeat; + case_control = control_t(); } - if (case_control.repeat & REPEAT_SETUP_TEARDOWN) { - case_control = control_t(); + if (setup_repeat & REPEAT_SETUP_TEARDOWN) { if (handlers.case_setup && (handlers.case_setup(case_current, test_index_of_case) != STATUS_CONTINUE)) { raise_failure(FAILURE_SETUP); schedule_next_case(); @@ -230,9 +233,9 @@ void Harness::run_next_case() if (case_current->handler) { case_current->handler(); } else if (case_current->control_handler) { - case_control = case_current->control_handler(); + case_control = case_control + case_current->control_handler(); } else if (case_current->repeat_count_handler) { - case_control = case_current->repeat_count_handler(case_repeat_count); + case_control = case_control + case_current->repeat_count_handler(case_repeat_count); } case_repeat_count++; diff --git "a/frameworks\\utest/utest/types.h" "b/frameworks\\utest/utest/types.h" index a63d9c863a..d2be7688a0 100644 --- "a/frameworks\\utest/utest/types.h" +++ "b/frameworks\\utest/utest/types.h" @@ -293,6 +293,7 @@ namespace v1 { * @returns * You can return `STATUS_ABORT` to indicate that this failure is non-recoverable, which will call the case * teardown handler with reason. If a failure occurs during teardown, the teardown will not be called again. + * You may return `STATUS_IGNORE` which will cause the harness to ignore and not count the failure. */ typedef status_t (*case_failure_handler_t)(const Case *const source, const failure_t reason);