Code review rework:

Updated include files within tests to use subdirectory/header.h
Updated global variables within tests to be static
Fixed indentation issue.
Renamed Timeout class variables to be more meaningful
Moved definition of utest_trace into stack_trace.cpp
Removed unecessary call to .clear() method in utest_add_to_trace()
Changed UTEST_LOG_FUNCTION macro to UTEST_LOG_FUNCTION();
Anna Bridge 2016-05-19 15:44:16 +01:00
parent 4cd34b1235
commit 710421d3e8
17 changed files with 121 additions and 121 deletions

View File

@ -17,14 +17,14 @@
* unit test. * unit test.
* *
*/ */
#include "mbed-drivers/mbed.h" #include "mbed.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "utest/utest.h" #include "utest.h"
#include "unity/unity.h" #include "unity.h"
using namespace utest::v1; using namespace utest::v1;
Timeout to; static Timeout utest_to;
void test_simple() { void test_simple() {
TEST_ASSERT_EQUAL(0, 0); TEST_ASSERT_EQUAL(0, 0);
@ -53,7 +53,7 @@ void test_callback_validate() {
control_t test_asynchronous() { control_t test_asynchronous() {
TEST_ASSERT_TRUE_MESSAGE(true, "(true == false) o_O"); TEST_ASSERT_TRUE_MESSAGE(true, "(true == false) o_O");
// Set up a callback in the future. This may also be an interrupt! // Set up a callback in the future. This may also be an interrupt!
to.attach_us(test_callback_validate, (100*1000)); // Fire after 100 ms utest_to.attach_us(test_callback_validate, (100*1000)); // Fire after 100 ms
// Set a 200ms timeout starting from now // Set a 200ms timeout starting from now
return CaseTimeout(200); return CaseTimeout(200);
@ -65,7 +65,7 @@ control_t test_asynchronous_timeout(const size_t call_count) {
// but automatically repeat only this handler on timeout. // but automatically repeat only this handler on timeout.
if (call_count >= 5) { if (call_count >= 5) {
// but after the 5th call, the callback finally gets validated // but after the 5th call, the callback finally gets validated
to.attach_us(test_callback_validate, (100*1000)); // Fire after 100 ms utest_to.attach_us(test_callback_validate, (100*1000)); // Fire after 100 ms
} }
return CaseRepeatHandlerOnTimeout(200); return CaseRepeatHandlerOnTimeout(200);
} }

View File

@ -1,22 +1,26 @@
#include "test_env.h" #include "mbed-drivers/mbed.h"
#include "mbed.h" #include "greentea-client/test_env.h"
#include "utest.h" #include "utest/utest.h"
#include "unity.h" #include "unity/unity.h"
#include "stack_trace.h"
using namespace utest::v1; using namespace utest::v1;
void test_simple() { void test_simple() {
UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(0, 0); TEST_ASSERT_EQUAL(0, 0);
printf("Simple test called\n"); printf("Simple test called\n");
} }
status_t test_repeats_setup(const Case *const source, const size_t index_of_case) { status_t test_repeats_setup(const Case *const source, const size_t index_of_case) {
UTEST_LOG_FUNCTION();
// Call the default handler for proper reporting // Call the default handler for proper reporting
status_t status = greentea_case_setup_handler(source, index_of_case); status_t status = greentea_case_setup_handler(source, index_of_case);
printf("Setting up for '%s'\n", source->get_description()); printf("Setting up for '%s'\n", source->get_description());
return status; return status;
} }
control_t test_repeats(const size_t call_count) { control_t test_repeats(const size_t call_count) {
UTEST_LOG_FUNCTION();
printf("Called for the %u. time\n", call_count); printf("Called for the %u. time\n", call_count);
TEST_ASSERT_NOT_EQUAL(3, call_count); TEST_ASSERT_NOT_EQUAL(3, call_count);
// Specify how often this test is repeated ie. n total calls // Specify how often this test is repeated ie. n total calls
@ -25,6 +29,7 @@ control_t test_repeats(const size_t call_count) {
// Custom setup handler required for proper Greentea support // Custom setup handler required for proper Greentea support
status_t greentea_setup(const size_t number_of_cases) { status_t greentea_setup(const size_t number_of_cases) {
UTEST_LOG_FUNCTION();
GREENTEA_SETUP(20, "default_auto"); GREENTEA_SETUP(20, "default_auto");
// Call the default reporting function // Call the default reporting function
return greentea_test_setup_handler(number_of_cases); return greentea_test_setup_handler(number_of_cases);
@ -43,8 +48,7 @@ extern void utest_run(const Specification& specification);
int main() int main()
{ {
// You MUST set the custom scheduler before running the specification. UTEST_LOG_FUNCTION();
Harness::set_scheduler(utest_v1_get_scheduler());
// Run the specification only AFTER setting the custom scheduler. // Run the specification only AFTER setting the custom scheduler.
Harness::run(specification); Harness::run(specification);
} }

View File

@ -14,19 +14,18 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "test_env.h" #include "mbed-drivers/mbed.h"
#include "mbed.h" #include "greentea-client/test_env.h"
#include "utest.h" #include "utest/utest.h"
#include "unity.h" #include "unity/unity.h"
#include <stdio.h> #include <stdio.h>
using namespace utest::v1; using namespace utest::v1;
int call_counter(0); static int call_counter(0);
Timeout to1; static Timeout utest_to;
Timeout to;
// Validate: Simple Validation ---------------------------------------------------------------------------------------- // Validate: Simple Validation ----------------------------------------------------------------------------------------
void simple_validation() void simple_validation()
@ -40,7 +39,7 @@ control_t simple_validation_case()
{ {
printf("Simple validation, posting callback\n"); printf("Simple validation, posting callback\n");
TEST_ASSERT_EQUAL(0, call_counter++); TEST_ASSERT_EQUAL(0, call_counter++);
to.attach_us(simple_validation, 100); // Fire after 100 us utest_to.attach_us(simple_validation, 100); // Fire after 100 us
return CaseAwait; return CaseAwait;
} }
@ -69,7 +68,7 @@ control_t multiple_validation_case()
{ {
TEST_ASSERT_EQUAL(2, call_counter++); TEST_ASSERT_EQUAL(2, call_counter++);
printf("Multiple validation callback posted.\n"); printf("Multiple validation callback posted.\n");
to1.attach_us(multiple_validation, 100000); // Fire after 100 ms utest_to.attach_us(multiple_validation, 100000); // Fire after 100 ms
return CaseAwait; return CaseAwait;
} }
@ -146,7 +145,7 @@ control_t attributed_validation_cancel_repeat_case()
TEST_ASSERT_EQUAL(18, call_counter++); TEST_ASSERT_EQUAL(18, call_counter++);
printf("Validation cancel repeat callback posted.\n"); printf("Validation cancel repeat callback posted.\n");
to1.attach_us(attributed_validation_cancel_repeat, 100000); // Fire after 100 ms utest_to.attach_us(attributed_validation_cancel_repeat, 100000); // Fire after 100 ms
// the RepeatAll will be cancelled during callback validation // the RepeatAll will be cancelled during callback validation
return CaseRepeatAll + CaseAwait; return CaseRepeatAll + CaseAwait;
} }
@ -178,8 +177,8 @@ control_t attributed_validation_enable_repeat_case(const size_t call_count)
{ {
if (call_count == 1) { if (call_count == 1) {
TEST_ASSERT_EQUAL(21, call_counter++); TEST_ASSERT_EQUAL(21, call_counter++);
printf("Validation enable repeat callback posted.\n"); printf("Validation enable repeat callback posted.\n");
to1.attach_us(attributed_validation_enable_repeat, 100000); // Fire after 100 ms utest_to.attach_us(attributed_validation_enable_repeat, 100000); // Fire after 100 ms
// the RepeatAll will be cancelled during callback validation // the RepeatAll will be cancelled during callback validation
return CaseAwait; return CaseAwait;
} }

View File

@ -14,20 +14,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "mbed.h" #include "mbed-drivers/mbed.h"
#include "test_env.h" #include "greentea-client/test_env.h"
#include "utest.h" #include "utest/utest.h"
#include "unity.h" #include "unity/unity.h"
#include "stack_trace.h" #include "utest/stack_trace.h"
using namespace utest::v1; using namespace utest::v1;
#ifdef UTEST_STACK_TRACE
std::string utest_trace[UTEST_MAX_BACKTRACE];
#endif // UTEST_STACK_TRACE
int call_counter(0); static int call_counter(0);
Timeout to; static Timeout utest_to;
class Utest_func_bind { class Utest_func_bind {
@ -48,29 +45,29 @@ private:
void await_case_validate(int expected_call_count) void await_case_validate(int expected_call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("await_case_validate called with expected call count of %d\n", expected_call_count); printf("await_case_validate called with expected call count of %d\n", expected_call_count);
TEST_ASSERT_EQUAL(expected_call_count, call_counter++); TEST_ASSERT_EQUAL(expected_call_count, call_counter++);
Harness::validate_callback(); Harness::validate_callback();
} }
Utest_func_bind validate1(await_case_validate, 7); static Utest_func_bind validate1(await_case_validate, 7);
Utest_func_bind validate2(await_case_validate, 37); static Utest_func_bind validate2(await_case_validate, 37);
Utest_func_bind validate3(await_case_validate, 50); static Utest_func_bind validate3(await_case_validate, 50);
// Control: Timeout (Failure) ----------------------------------------------------------------------------------------- // Control: Timeout (Failure) -----------------------------------------------------------------------------------------
control_t timeout_failure_case(const size_t call_count) control_t timeout_failure_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, call_count); TEST_ASSERT_EQUAL(1, call_count);
TEST_ASSERT_EQUAL(0, call_counter++); TEST_ASSERT_EQUAL(0, call_counter++);
return CaseTimeout(100); return CaseTimeout(100);
} }
status_t timeout_failure_case_failure_handler(const Case *const source, const failure_t failure) status_t timeout_failure_case_failure_handler(const Case *const source, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, call_counter++); TEST_ASSERT_EQUAL(1, call_counter++);
TEST_ASSERT_EQUAL(REASON_TIMEOUT, failure.reason); TEST_ASSERT_EQUAL(REASON_TIMEOUT, failure.reason);
TEST_ASSERT_EQUAL(LOCATION_CASE_HANDLER, failure.location); TEST_ASSERT_EQUAL(LOCATION_CASE_HANDLER, failure.location);
@ -79,7 +76,7 @@ status_t timeout_failure_case_failure_handler(const Case *const source, const fa
} }
status_t timeout_failure_case_teardown(const Case *const source, const size_t passed, const size_t failed, const failure_t failure) status_t timeout_failure_case_teardown(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(2, call_counter++); TEST_ASSERT_EQUAL(2, call_counter++);
TEST_ASSERT_EQUAL(0, passed); TEST_ASSERT_EQUAL(0, passed);
TEST_ASSERT_EQUAL(1, failed); TEST_ASSERT_EQUAL(1, failed);
@ -90,23 +87,23 @@ status_t timeout_failure_case_teardown(const Case *const source, const size_t pa
// Control: Timeout (Success) ----------------------------------------------------------------------------------------- // Control: Timeout (Success) -----------------------------------------------------------------------------------------
void timeout_success_case_validate() { void timeout_success_case_validate() {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(4, call_counter++); TEST_ASSERT_EQUAL(4, call_counter++);
Harness::validate_callback(); Harness::validate_callback();
} }
control_t timeout_success_case(const size_t call_count) control_t timeout_success_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, call_count); TEST_ASSERT_EQUAL(1, call_count);
TEST_ASSERT_EQUAL(3, call_counter++); TEST_ASSERT_EQUAL(3, call_counter++);
to.attach_us(timeout_success_case_validate, 100000); // Fire after 100 ms utest_to.attach_us(timeout_success_case_validate, 100000); // Fire after 100 ms
return CaseTimeout(200); return CaseTimeout(200);
} }
status_t timeout_success_case_failure_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure) status_t timeout_success_case_failure_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(5, call_counter++); TEST_ASSERT_EQUAL(5, call_counter++);
TEST_ASSERT_EQUAL(1, passed); TEST_ASSERT_EQUAL(1, passed);
TEST_ASSERT_EQUAL(0, failed); TEST_ASSERT_EQUAL(0, failed);
@ -118,11 +115,11 @@ status_t timeout_success_case_failure_handler(const Case *const source, const si
// Control: Await ----------------------------------------------------------------------------------------------------- // Control: Await -----------------------------------------------------------------------------------------------------
control_t await_case(const size_t call_count) control_t await_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, call_count); TEST_ASSERT_EQUAL(1, call_count);
TEST_ASSERT_EQUAL(6, call_counter++); TEST_ASSERT_EQUAL(6, call_counter++);
to.attach_us(&validate1, &Utest_func_bind::callback, (1372*1000)); // Fire after 1372 ms utest_to.attach_us(&validate1, &Utest_func_bind::callback, (1372*1000)); // Fire after 1372 ms
return CaseAwait; return CaseAwait;
} }
@ -135,7 +132,7 @@ status_t repeat_all_on_timeout_case_setup(const Case *const source, const size_t
UTEST_TRACE_START UTEST_TRACE_START
repeat_all_start_flag = false; repeat_all_start_flag = false;
} }
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
static int repeat_counter(0); static int repeat_counter(0);
TEST_ASSERT_EQUAL(3, index_of_case); TEST_ASSERT_EQUAL(3, index_of_case);
TEST_ASSERT_EQUAL(repeat_counter*3 + 8, call_counter++); TEST_ASSERT_EQUAL(repeat_counter*3 + 8, call_counter++);
@ -144,7 +141,7 @@ status_t repeat_all_on_timeout_case_setup(const Case *const source, const size_t
} }
control_t repeat_all_on_timeout_case(const size_t call_count) control_t repeat_all_on_timeout_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("Running case handler for %u. time\n", call_count); printf("Running case handler for %u. time\n", call_count);
static int repeat_counter(1); static int repeat_counter(1);
TEST_ASSERT_EQUAL(repeat_counter++, call_count); TEST_ASSERT_EQUAL(repeat_counter++, call_count);
@ -152,13 +149,13 @@ control_t repeat_all_on_timeout_case(const size_t call_count)
TEST_ASSERT_EQUAL((call_count-1)*3 + 9, call_counter++); TEST_ASSERT_EQUAL((call_count-1)*3 + 9, call_counter++);
if (call_count == 10) { if (call_count == 10) {
printf("Scheduling await_case_validate with value 37"); printf("Scheduling await_case_validate with value 37");
to.attach_us(&validate2, &Utest_func_bind::callback, (50*1000)); // Fire after 50ms utest_to.attach_us(&validate2, &Utest_func_bind::callback, (50*1000)); // Fire after 50ms
} }
return CaseRepeatAllOnTimeout(100); return CaseRepeatAllOnTimeout(100);
} }
status_t repeat_all_on_timeout_case_teardown(const Case *const source, const size_t passed, const size_t failed, const failure_t failure) status_t repeat_all_on_timeout_case_teardown(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
static int repeat_counter(0); static int repeat_counter(0);
printf("Call counter = %d, passed =%u, failed = %u\n", call_counter, passed, failed); printf("Call counter = %d, passed =%u, failed = %u\n", call_counter, passed, failed);
@ -174,7 +171,7 @@ status_t repeat_all_on_timeout_case_teardown(const Case *const source, const siz
// Control: RepeatAllOnTimeout ---------------------------------------------------------------------------------------- // Control: RepeatAllOnTimeout ----------------------------------------------------------------------------------------
status_t repeat_handler_on_timeout_case_setup(const Case *const source, const size_t index_of_case) status_t repeat_handler_on_timeout_case_setup(const Case *const source, const size_t index_of_case)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(4, index_of_case); TEST_ASSERT_EQUAL(4, index_of_case);
TEST_ASSERT_EQUAL(39, call_counter++); TEST_ASSERT_EQUAL(39, call_counter++);
return greentea_case_setup_handler(source, index_of_case); return greentea_case_setup_handler(source, index_of_case);
@ -182,7 +179,7 @@ status_t repeat_handler_on_timeout_case_setup(const Case *const source, const si
control_t repeat_handler_on_timeout_case(const size_t call_count) control_t repeat_handler_on_timeout_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("Running case handler for %u. time\n", call_count); printf("Running case handler for %u. time\n", call_count);
static int repeat_counter(1); static int repeat_counter(1);
TEST_ASSERT_EQUAL(repeat_counter++, call_count); TEST_ASSERT_EQUAL(repeat_counter++, call_count);
@ -190,13 +187,13 @@ control_t repeat_handler_on_timeout_case(const size_t call_count)
TEST_ASSERT_EQUAL(call_count-1 + 40, call_counter++); TEST_ASSERT_EQUAL(call_count-1 + 40, call_counter++);
if (call_count == 10) { if (call_count == 10) {
printf("Scheduling await_case_validate with value 50"); printf("Scheduling await_case_validate with value 50");
to.attach_us(&validate3, &Utest_func_bind::callback, (50*1000)); // Fire after 50ms utest_to.attach_us(&validate3, &Utest_func_bind::callback, (50*1000)); // Fire after 50ms
} }
return CaseRepeatHandlerOnTimeout(100); return CaseRepeatHandlerOnTimeout(100);
} }
status_t repeat_handler_on_timeout_case_teardown(const Case *const source, const size_t passed, const size_t failed, const failure_t failure) status_t repeat_handler_on_timeout_case_teardown(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, passed); TEST_ASSERT_EQUAL(1, passed);
TEST_ASSERT_EQUAL(0, failed); TEST_ASSERT_EQUAL(0, failed);
TEST_ASSERT_EQUAL(REASON_NONE, failure.reason); TEST_ASSERT_EQUAL(REASON_NONE, failure.reason);
@ -208,7 +205,7 @@ status_t repeat_handler_on_timeout_case_teardown(const Case *const source, const
// Control: NoTimeout ------------------------------------------------------------------------------------------------- // Control: NoTimeout -------------------------------------------------------------------------------------------------
control_t no_timeout_case(const size_t call_count) control_t no_timeout_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, call_count); TEST_ASSERT_EQUAL(1, call_count);
TEST_ASSERT_EQUAL(52, call_counter++); TEST_ASSERT_EQUAL(52, call_counter++);
return CaseNoTimeout; return CaseNoTimeout;
@ -217,7 +214,7 @@ control_t no_timeout_case(const size_t call_count)
// Control: NoTimeout ------------------------------------------------------------------------------------------------- // Control: NoTimeout -------------------------------------------------------------------------------------------------
control_t next_case(const size_t call_count) control_t next_case(const size_t call_count)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(1, call_count); TEST_ASSERT_EQUAL(1, call_count);
TEST_ASSERT_EQUAL(53, call_counter++); TEST_ASSERT_EQUAL(53, call_counter++);
return CaseNoTimeout; return CaseNoTimeout;

View File

@ -21,7 +21,7 @@
using namespace utest::v1; using namespace utest::v1;
int call_counter(0); static int call_counter(0);
// Control: RepeatAll ------------------------------------------------------------------------------------------------- // Control: RepeatAll -------------------------------------------------------------------------------------------------
status_t repeat_all_case_setup(const Case *const source, const size_t index_of_case) status_t repeat_all_case_setup(const Case *const source, const size_t index_of_case)

View File

@ -22,7 +22,7 @@
using namespace utest::v1; using namespace utest::v1;
int call_counter(0); static int call_counter(0);
void handler_case_2() void handler_case_2()
{ {

View File

@ -21,7 +21,7 @@
using namespace utest::v1; using namespace utest::v1;
int call_counter(0); static int call_counter(0);
void never_call_case() void never_call_case()
{ {

View File

@ -21,7 +21,7 @@
using namespace utest::v1; using namespace utest::v1;
int call_counter(0); static int call_counter(0);
// Continue Teardown Handler ------------------------------------------------------------------------------------------ // Continue Teardown Handler ------------------------------------------------------------------------------------------
void continue_case() void continue_case()

View File

@ -22,40 +22,36 @@
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "utest/utest.h" #include "utest/utest.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "stack_trace.h" #include "utest/stack_trace.h"
#include "ticker_api.h" #include "ticker_api.h"
#include "us_ticker_api.h" #include "us_ticker_api.h"
using namespace utest::v1; using namespace utest::v1;
#ifdef UTEST_STACK_TRACE
std::string utest_trace[UTEST_MAX_BACKTRACE];
#endif // UTEST_STACK_TRACE
// only one callback is active at any given time // only one callback is active at any given time
volatile utest_v1_harness_callback_t minimal_callback; volatile utest_v1_harness_callback_t minimal_callback;
volatile utest_v1_harness_callback_t ticker_callback; volatile utest_v1_harness_callback_t ticker_callback;
Timeout utest_minimal_object; static Timeout utest_minimal_object;
// Scheduler ---------------------------------------------------------------------------------------------------------- // Scheduler ----------------------------------------------------------------------------------------------------------
static void ticker_handler() static void ticker_handler()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
// printf("\t\t>>> Ticker callback fired for %p.\n", ticker_callback); // printf("\t\t>>> Ticker callback fired for %p.\n", ticker_callback);
minimal_callback = ticker_callback; minimal_callback = ticker_callback;
} }
static int32_t utest_minimal_init() static int32_t utest_minimal_init()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
minimal_callback = NULL; minimal_callback = NULL;
ticker_callback = NULL; ticker_callback = NULL;
return 0; return 0;
} }
static void *utest_minimal_post(const utest_v1_harness_callback_t callback, timestamp_t delay_ms) static void *utest_minimal_post(const utest_v1_harness_callback_t callback, timestamp_t delay_ms)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
// printf("\t\t>>> Schedule %p with %ums delay => %p.\n", callback, (unsigned int)delay_ms, (void*)1); // printf("\t\t>>> Schedule %p with %ums delay => %p.\n", callback, (unsigned int)delay_ms, (void*)1);
timestamp_t delay_us = delay_ms *1000; timestamp_t delay_us = delay_ms *1000;
@ -72,7 +68,7 @@ static void *utest_minimal_post(const utest_v1_harness_callback_t callback, tim
} }
static int32_t utest_minimal_cancel(void *handle) static int32_t utest_minimal_cancel(void *handle)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("\t\t>>> Cancel %p => %u\n", handle, (unsigned int)0); printf("\t\t>>> Cancel %p => %u\n", handle, (unsigned int)0);
(void) handle; (void) handle;
utest_minimal_object.detach(); utest_minimal_object.detach();
@ -80,7 +76,7 @@ static int32_t utest_minimal_cancel(void *handle)
} }
static int32_t utest_minimal_run() static int32_t utest_minimal_run()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
/* This is the amazing minimal scheduler. /* This is the amazing minimal scheduler.
* This is just a busy loop that calls the callbacks in this context. * This is just a busy loop that calls the callbacks in this context.
* THIS LOOP IS BLOCKING. * THIS LOOP IS BLOCKING.
@ -115,7 +111,7 @@ int call_counter(0);
// Basic Test Case ---------------------------------------------------------------------------------------------------- // Basic Test Case ----------------------------------------------------------------------------------------------------
control_t test_case() control_t test_case()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
static int counter(0); static int counter(0);
TEST_ASSERT_EQUAL(counter++, call_counter++); TEST_ASSERT_EQUAL(counter++, call_counter++);
printf("Running Test #%d\n", counter); printf("Running Test #%d\n", counter);
@ -125,7 +121,7 @@ control_t test_case()
// Async Test Case Failure -------------------------------------------------------------------------------------------- // Async Test Case Failure --------------------------------------------------------------------------------------------
control_t test_case_async() control_t test_case_async()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
static int counter(3); static int counter(3);
TEST_ASSERT_EQUAL(counter++, call_counter++); TEST_ASSERT_EQUAL(counter++, call_counter++);
printf("Running Test #%d\n", counter); printf("Running Test #%d\n", counter);
@ -133,7 +129,7 @@ control_t test_case_async()
} }
status_t test_case_async_failure(const Case *const source, const failure_t reason) status_t test_case_async_failure(const Case *const source, const failure_t reason)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
// ignore the timeout, since this is a test // ignore the timeout, since this is a test
return greentea_case_failure_continue_handler(source, reason.ignored()); return greentea_case_failure_continue_handler(source, reason.ignored());
} }
@ -154,7 +150,7 @@ status_t greentea_setup(const size_t number_of_cases)
} }
void greentea_teardown(const size_t passed, const size_t failed, const failure_t failure) void greentea_teardown(const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
TEST_ASSERT_EQUAL(4, call_counter++); TEST_ASSERT_EQUAL(4, call_counter++);
TEST_ASSERT_EQUAL(4, passed); TEST_ASSERT_EQUAL(4, passed);
TEST_ASSERT_EQUAL(0, failed); TEST_ASSERT_EQUAL(0, failed);

View File

@ -22,7 +22,7 @@
using namespace utest::v1; using namespace utest::v1;
bool failure_is_in_setup = false; static bool failure_is_in_setup = false;
void never_call_case() void never_call_case()
{ {

View File

@ -37,7 +37,7 @@ const handlers_t utest::v1::verbose_continue_handlers = {
// --- SPECIAL HANDLERS --- // --- SPECIAL HANDLERS ---
static void test_failure_handler(const failure_t failure) { static void test_failure_handler(const failure_t failure) {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if (failure.location == LOCATION_TEST_SETUP || failure.location == LOCATION_TEST_TEARDOWN) { if (failure.location == LOCATION_TEST_SETUP || failure.location == LOCATION_TEST_TEARDOWN) {
verbose_test_failure_handler(failure); verbose_test_failure_handler(failure);
printf("{{failure}}\n{{end}}\n"); printf("{{failure}}\n{{end}}\n");
@ -48,14 +48,14 @@ static void test_failure_handler(const failure_t failure) {
// --- VERBOSE TEST HANDLERS --- // --- VERBOSE TEST HANDLERS ---
utest::v1::status_t utest::v1::verbose_test_setup_handler(const size_t number_of_cases) utest::v1::status_t utest::v1::verbose_test_setup_handler(const size_t number_of_cases)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf(">>> Running %u test cases...\n", number_of_cases); printf(">>> Running %u test cases...\n", number_of_cases);
return STATUS_CONTINUE; return STATUS_CONTINUE;
} }
void utest::v1::verbose_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure) void utest::v1::verbose_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("\n>>> Test cases: %u passed, %u failed", passed, failed); printf("\n>>> Test cases: %u passed, %u failed", passed, failed);
if (failure.reason == REASON_NONE) { if (failure.reason == REASON_NONE) {
printf("\n"); printf("\n");
@ -74,14 +74,14 @@ void utest::v1::verbose_test_failure_handler(const failure_t failure)
// --- VERBOSE CASE HANDLERS --- // --- VERBOSE CASE HANDLERS ---
utest::v1::status_t utest::v1::verbose_case_setup_handler(const Case *const source, const size_t index_of_case) utest::v1::status_t utest::v1::verbose_case_setup_handler(const Case *const source, const size_t index_of_case)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("\n>>> Running case #%u: '%s'...\n", index_of_case + 1, source->get_description()); printf("\n>>> Running case #%u: '%s'...\n", index_of_case + 1, source->get_description());
return STATUS_CONTINUE; return STATUS_CONTINUE;
} }
utest::v1::status_t utest::v1::verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure) utest::v1::status_t utest::v1::verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf(">>> '%s': %u passed, %u failed", source->get_description(), passed, failed); printf(">>> '%s': %u passed, %u failed", source->get_description(), passed, failed);
if (failure.reason == REASON_NONE) { if (failure.reason == REASON_NONE) {
printf("\n"); printf("\n");
@ -93,7 +93,7 @@ utest::v1::status_t utest::v1::verbose_case_teardown_handler(const Case *const s
utest::v1::status_t utest::v1::verbose_case_failure_handler(const Case *const /*source*/, const failure_t failure) utest::v1::status_t utest::v1::verbose_case_failure_handler(const Case *const /*source*/, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if (!(failure.reason & REASON_ASSERTION)) { if (!(failure.reason & REASON_ASSERTION)) {
verbose_test_failure_handler(failure); verbose_test_failure_handler(failure);
} }

View File

@ -58,7 +58,7 @@ const handlers_t utest::v1::selftest_handlers = {
// --- SPECIAL HANDLERS --- // --- SPECIAL HANDLERS ---
static utest::v1::status_t unknown_test_setup_handler(const size_t) { static utest::v1::status_t unknown_test_setup_handler(const size_t) {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf(">>> I do not know how to tell greentea that the test started, since\n"); printf(">>> I do not know how to tell greentea that the test started, since\n");
printf(">>> you forgot to override the `test_setup_handler` in your specification.\n"); printf(">>> you forgot to override the `test_setup_handler` in your specification.\n");
@ -66,7 +66,7 @@ static utest::v1::status_t unknown_test_setup_handler(const size_t) {
} }
static void selftest_failure_handler(const failure_t failure) { static void selftest_failure_handler(const failure_t failure) {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if (failure.location == LOCATION_TEST_SETUP || failure.location == LOCATION_TEST_TEARDOWN || failure.reason == REASON_ASSERTION) { if (failure.location == LOCATION_TEST_SETUP || failure.location == LOCATION_TEST_TEARDOWN || failure.reason == REASON_ASSERTION) {
verbose_test_failure_handler(failure); verbose_test_failure_handler(failure);
} }
@ -78,7 +78,7 @@ static void selftest_failure_handler(const failure_t failure) {
} }
static void test_failure_handler(const failure_t failure) { static void test_failure_handler(const failure_t failure) {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if (failure.location == LOCATION_TEST_SETUP || failure.location == LOCATION_TEST_TEARDOWN) { if (failure.location == LOCATION_TEST_SETUP || failure.location == LOCATION_TEST_TEARDOWN) {
verbose_test_failure_handler(failure); verbose_test_failure_handler(failure);
GREENTEA_TESTSUITE_RESULT(false); GREENTEA_TESTSUITE_RESULT(false);
@ -89,14 +89,14 @@ static void test_failure_handler(const failure_t failure) {
// --- GREENTEA HANDLERS --- // --- GREENTEA HANDLERS ---
utest::v1::status_t utest::v1::greentea_test_setup_handler(const size_t number_of_cases) utest::v1::status_t utest::v1::greentea_test_setup_handler(const size_t number_of_cases)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
greentea_send_kv(TEST_ENV_TESTCASE_COUNT, number_of_cases); greentea_send_kv(TEST_ENV_TESTCASE_COUNT, number_of_cases);
return verbose_test_setup_handler(number_of_cases); return verbose_test_setup_handler(number_of_cases);
} }
void utest::v1::greentea_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure) void utest::v1::greentea_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
verbose_test_teardown_handler(passed, failed, failure); verbose_test_teardown_handler(passed, failed, failure);
greentea_send_kv(TEST_ENV_TESTCASE_SUMMARY, passed, failed); greentea_send_kv(TEST_ENV_TESTCASE_SUMMARY, passed, failed);
int result = !(failed || (failure.reason && !(failure.reason & REASON_IGNORE))); int result = !(failed || (failure.reason && !(failure.reason & REASON_IGNORE)));
@ -105,14 +105,14 @@ void utest::v1::greentea_test_teardown_handler(const size_t passed, const size_t
void utest::v1::greentea_test_failure_handler(const failure_t failure) void utest::v1::greentea_test_failure_handler(const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
verbose_test_failure_handler(failure); verbose_test_failure_handler(failure);
} }
// --- GREENTEA CASE HANDLERS --- // --- GREENTEA CASE HANDLERS ---
utest::v1::status_t utest::v1::greentea_case_setup_handler(const Case *const source, const size_t index_of_case) utest::v1::status_t utest::v1::greentea_case_setup_handler(const Case *const source, const size_t index_of_case)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
utest::v1::status_t status = verbose_case_setup_handler(source, index_of_case); utest::v1::status_t status = verbose_case_setup_handler(source, index_of_case);
greentea_send_kv(TEST_ENV_TESTCASE_START, source->get_description()); greentea_send_kv(TEST_ENV_TESTCASE_START, source->get_description());
return status; return status;
@ -120,20 +120,20 @@ utest::v1::status_t utest::v1::greentea_case_setup_handler(const Case *const sou
utest::v1::status_t utest::v1::greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure) utest::v1::status_t utest::v1::greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
greentea_send_kv(TEST_ENV_TESTCASE_FINISH, source->get_description(), passed, failed); greentea_send_kv(TEST_ENV_TESTCASE_FINISH, source->get_description(), passed, failed);
return verbose_case_teardown_handler(source, passed, failed, failure); return verbose_case_teardown_handler(source, passed, failed, failure);
} }
utest::v1::status_t utest::v1::greentea_case_failure_abort_handler(const Case *const source, const failure_t failure) utest::v1::status_t utest::v1::greentea_case_failure_abort_handler(const Case *const source, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
utest::v1::status_t status = verbose_case_failure_handler(source, failure); utest::v1::status_t status = verbose_case_failure_handler(source, failure);
return (status == STATUS_IGNORE) ? STATUS_IGNORE : STATUS_ABORT; return (status == STATUS_IGNORE) ? STATUS_IGNORE : STATUS_ABORT;
} }
utest::v1::status_t utest::v1::greentea_case_failure_continue_handler(const Case *const source, const failure_t failure) utest::v1::status_t utest::v1::greentea_case_failure_continue_handler(const Case *const source, const failure_t failure)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
return verbose_case_failure_handler(source, failure); return verbose_case_failure_handler(source, failure);
} }

View File

@ -55,19 +55,19 @@ namespace
} }
static void die() { static void die() {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
while(1) ; while(1) ;
} }
static bool is_scheduler_valid(const utest_v1_scheduler_t scheduler) static bool is_scheduler_valid(const utest_v1_scheduler_t scheduler)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
return (scheduler.init && scheduler.post && scheduler.cancel && scheduler.run); return (scheduler.init && scheduler.post && scheduler.cancel && scheduler.run);
} }
bool Harness::set_scheduler(const utest_v1_scheduler_t scheduler) bool Harness::set_scheduler(const utest_v1_scheduler_t scheduler)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if (is_scheduler_valid(scheduler)) { if (is_scheduler_valid(scheduler)) {
::scheduler = scheduler; ::scheduler = scheduler;
return true; return true;
@ -77,27 +77,33 @@ bool Harness::set_scheduler(const utest_v1_scheduler_t scheduler)
bool Harness::run(const Specification& specification, size_t) bool Harness::run(const Specification& specification, size_t)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
return run(specification); return run(specification);
} }
bool Harness::run(const Specification& specification) bool Harness::run(const Specification& specification)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
printf("here in harness::run 1\n");
// check if a specification is currently running // check if a specification is currently running
if (is_busy()) if (is_busy())
return false; return false;
printf("here in harness::run 2\n");
// if the scheduler is invalid, this is the first time we are calling // if the scheduler is invalid, this is the first time we are calling
if (!is_scheduler_valid(scheduler)) if (!is_scheduler_valid(scheduler))
scheduler = utest_v1_get_scheduler(); scheduler = utest_v1_get_scheduler();
// if the scheduler is still invalid, abort printf("here in harness::run 3\n");
// if the scheduler is still invalid, abort
if (!is_scheduler_valid(scheduler)) if (!is_scheduler_valid(scheduler))
return false; return false;
printf("here in harness::run 4\n");
// if the scheduler failed to initialize, abort // if the scheduler failed to initialize, abort
if (scheduler.init() != 0) if (scheduler.init() != 0)
return false; return false;
printf("here in harness::run 5\n");
test_cases = specification.cases; test_cases = specification.cases;
test_length = specification.length; test_length = specification.length;
defaults = specification.defaults; defaults = specification.defaults;
@ -149,7 +155,7 @@ bool Harness::run(const Specification& specification)
void Harness::raise_failure(const failure_reason_t reason) void Harness::raise_failure(const failure_reason_t reason)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
// ignore a failure, if the Harness has not been initialized. // ignore a failure, if the Harness has not been initialized.
// this allows using unity assertion macros without setting up utest. // this allows using unity assertion macros without setting up utest.
if (test_cases == NULL) return; if (test_cases == NULL) return;
@ -195,7 +201,7 @@ void Harness::raise_failure(const failure_reason_t reason)
void Harness::schedule_next_case() void Harness::schedule_next_case()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if (!case_timeout_occurred && case_failed_before == case_failed) { if (!case_timeout_occurred && case_failed_before == case_failed) {
case_passed++; case_passed++;
} }
@ -231,7 +237,7 @@ void Harness::schedule_next_case()
void Harness::handle_timeout() void Harness::handle_timeout()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
{ {
UTEST_ENTER_CRITICAL_SECTION; UTEST_ENTER_CRITICAL_SECTION;
@ -249,7 +255,7 @@ void Harness::handle_timeout()
void Harness::validate_callback(const control_t control) void Harness::validate_callback(const control_t control)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
UTEST_ENTER_CRITICAL_SECTION; UTEST_ENTER_CRITICAL_SECTION;
case_validation_count++; case_validation_count++;
@ -269,7 +275,7 @@ void Harness::validate_callback(const control_t control)
bool Harness::is_busy() bool Harness::is_busy()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
UTEST_ENTER_CRITICAL_SECTION; UTEST_ENTER_CRITICAL_SECTION;
if (!test_cases) return false; if (!test_cases) return false;
if (!case_current) return false; if (!case_current) return false;
@ -281,7 +287,7 @@ bool Harness::is_busy()
void Harness::run_next_case() void Harness::run_next_case()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
if(case_current < (test_cases + test_length)) if(case_current < (test_cases + test_length))
{ {
handlers.case_setup = defaults.get_handler(case_current->setup_handler); handlers.case_setup = defaults.get_handler(case_current->setup_handler);

View File

@ -69,20 +69,20 @@ Timeout utest_timeout_object;
static void ticker_handler() static void ticker_handler()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
//printf("\t\t>>> Ticker callback fired for %p.\n", ticker_callback); //printf("\t\t>>> Ticker callback fired for %p.\n", ticker_callback);
minimal_callback = ticker_callback; minimal_callback = ticker_callback;
} }
static int32_t utest_us_ticker_init() static int32_t utest_us_ticker_init()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
// Ticker scheduler does not require any initialisation so return immediately // Ticker scheduler does not require any initialisation so return immediately
return 0; return 0;
} }
static void *utest_us_ticker_post(const utest_v1_harness_callback_t callback, timestamp_t delay_ms) static void *utest_us_ticker_post(const utest_v1_harness_callback_t callback, timestamp_t delay_ms)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
timestamp_t delay_us = delay_ms *1000; timestamp_t delay_us = delay_ms *1000;
//printf("\t\t>>> Schedule %p with %ums delay => %p.\n", callback, (unsigned int)delay_ms, (void*)1); //printf("\t\t>>> Schedule %p with %ums delay => %p.\n", callback, (unsigned int)delay_ms, (void*)1);
@ -103,7 +103,7 @@ static void *utest_us_ticker_post(const utest_v1_harness_callback_t callback, ti
} }
static int32_t utest_us_ticker_cancel(void *handle) static int32_t utest_us_ticker_cancel(void *handle)
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
//printf("\t\t>>> Cancel %p => %u\n", handle, (unsigned int)0); //printf("\t\t>>> Cancel %p => %u\n", handle, (unsigned int)0);
(void) handle; (void) handle;
utest_timeout_object.detach(); utest_timeout_object.detach();
@ -111,7 +111,7 @@ static int32_t utest_us_ticker_cancel(void *handle)
} }
static int32_t utest_us_ticker_run() static int32_t utest_us_ticker_run()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
while(1) while(1)
{ {
// check if a new callback has been set // check if a new callback has been set
@ -138,7 +138,7 @@ static const utest_v1_scheduler_t utest_v1_scheduler =
}; };
utest_v1_scheduler_t utest_v1_get_scheduler() utest_v1_scheduler_t utest_v1_get_scheduler()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
return utest_v1_scheduler; return utest_v1_scheduler;
} }
} }

View File

@ -26,6 +26,8 @@
using namespace utest::v1; using namespace utest::v1;
std::string utest_trace[UTEST_MAX_BACKTRACE];
static unsigned trace_index = 0; static unsigned trace_index = 0;
static unsigned total_calls = 0; static unsigned total_calls = 0;
@ -39,11 +41,7 @@ void utest_trace_initialise()
} }
void utest_add_to_trace(char *func_name) void utest_add_to_trace(char *func_name)
{ {
// Check if we have already used this entry. If so free the previously allocated
// string.
utest_trace[trace_index].clear();
utest_trace[trace_index] = std::string(func_name); utest_trace[trace_index] = std::string(func_name);
trace_index = (trace_index + 1 == UTEST_MAX_BACKTRACE) ? 0 : trace_index + 1; trace_index = (trace_index + 1 == UTEST_MAX_BACKTRACE) ? 0 : trace_index + 1;
total_calls ++; total_calls ++;

View File

@ -23,13 +23,13 @@
extern "C" extern "C"
void utest_unity_assert_failure() void utest_unity_assert_failure()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
utest::v1::Harness::raise_failure(utest::v1::REASON_ASSERTION); utest::v1::Harness::raise_failure(utest::v1::REASON_ASSERTION);
} }
extern "C" extern "C"
void utest_unity_ignore_failure() void utest_unity_ignore_failure()
{ {
UTEST_LOG_FUNCTION UTEST_LOG_FUNCTION();
utest::v1::Harness::raise_failure(utest::v1::failure_reason_t(utest::v1::REASON_ASSERTION | utest::v1::REASON_IGNORE)); utest::v1::Harness::raise_failure(utest::v1::failure_reason_t(utest::v1::REASON_ASSERTION | utest::v1::REASON_IGNORE));
} }

View File

@ -29,13 +29,13 @@ extern void utest_trace_initialise();
extern void utest_add_to_trace(char *func_name); extern void utest_add_to_trace(char *func_name);
extern void utest_dump_trace(); extern void utest_dump_trace();
#define UTEST_LOG_FUNCTION utest_add_to_trace((char *)__func__); #define UTEST_LOG_FUNCTION(); utest_add_to_trace((char *)__func__);
#define UTEST_TRACE_START utest_trace_initialise(); #define UTEST_TRACE_START utest_trace_initialise();
#define UTEST_DUMP_TRACE utest_dump_trace(); #define UTEST_DUMP_TRACE utest_dump_trace();
#else #else
#define UTEST_LOG_FUNCTION #define UTEST_LOG_FUNCTION();
#define UTEST_TRACE_START #define UTEST_TRACE_START
#define UTEST_DUMP_TRACE #define UTEST_DUMP_TRACE