diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-09-16 11:11:27 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 0ce0844de22c483883ff3c40373434d5944d86ca (patch) | |
tree | 6eacdd6967a483830ce0906e9b1c1a0ccdcdbc29 /tests/framework | |
parent | 6f4d49f95c3598e41a7532faa637f42d8be5f4dd (diff) | |
download | ComputeLibrary-0ce0844de22c483883ff3c40373434d5944d86ca.tar.gz |
COMPMID-417: Fix error logging
Previously every failed expectation was shown as expected error evene if
the test wasn't marked as expected failure.
Change-Id: Ie72a69ae17e6f9e625560f9b011f5c0457c0a0d7
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87948
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'tests/framework')
-rw-r--r-- | tests/framework/Framework.cpp | 17 | ||||
-rw-r--r-- | tests/framework/Framework.h | 1 |
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index 853ea251c3..9a67cca184 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -165,16 +165,17 @@ void Framework::log_test_end(const TestInfo &info) void Framework::log_failed_expectation(const TestError &error) { + ARM_COMPUTE_ERROR_ON(_current_test_info == nullptr); + ARM_COMPUTE_ERROR_ON(_current_test_result == nullptr); + + const bool is_expected_failure = _current_test_info->status == TestCaseFactory::Status::EXPECTED_FAILURE; + if(_log_level >= error.level() && _printer != nullptr) { - constexpr bool expected_error = true; - _printer->print_error(error, expected_error); + _printer->print_error(error, is_expected_failure); } - if(_current_test_result != nullptr) - { - _current_test_result->status = TestResult::Status::FAILED; - } + _current_test_result->status = TestResult::Status::FAILED; } void Framework::log_info(const std::string &info) @@ -229,6 +230,7 @@ void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) Profiler profiler = get_profiler(); TestResult result(TestResult::Status::NOT_RUN); + _current_test_info = &info; _current_test_result = &result; if(_log_level >= LogLevel::ERRORS && _printer != nullptr) @@ -236,7 +238,7 @@ void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) _printer->print_errors_header(); } - const bool is_expected_failure = test_factory.status() == TestCaseFactory::Status::EXPECTED_FAILURE; + const bool is_expected_failure = info.status == TestCaseFactory::Status::EXPECTED_FAILURE; try { @@ -363,6 +365,7 @@ void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) _printer->print_errors_footer(); } + _current_test_info = nullptr; _current_test_result = nullptr; if(result.status == TestResult::Status::FAILED) diff --git a/tests/framework/Framework.h b/tests/framework/Framework.h index d77a1b2549..3741e44694 100644 --- a/tests/framework/Framework.h +++ b/tests/framework/Framework.h @@ -316,6 +316,7 @@ private: std::set<InstrumentType> _instruments{ InstrumentType::NONE }; TestFilter _test_filter{}; LogLevel _log_level{ LogLevel::ALL }; + const TestInfo *_current_test_info{ nullptr }; TestResult *_current_test_result{ nullptr }; std::vector<std::string> _test_info{}; }; |