Do not report failure with uninitialized harness.

Calling `raise_failure` before harness is initialized can print
unintentional failure strings.
This disallows using Unity macros outside of the utest harness.
Niklas Hauser 2016-02-29 15:21:17 +01:00 committed by Martin Kojtal
parent 4db0ec48c3
commit 01040bb9bf
1 changed files with 4 additions and 0 deletions

View File

@ -99,6 +99,10 @@ bool Harness::run(const Specification& specification, std::size_t start_case)
void Harness::raise_failure(const failure_reason_t reason)
{
// ignore a failure, if the Harness has not been initialized.
// this allows using unity assertion macros without setting up utest.
if (test_cases == NULL) return;
status_t fail_status = STATUS_ABORT;
{
mbed::util::CriticalSectionLock lock;