aboutsummaryrefslogtreecommitdiff
path: root/tests/framework/Framework.cpp
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-09-16 11:11:27 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit0ce0844de22c483883ff3c40373434d5944d86ca (patch)
tree6eacdd6967a483830ce0906e9b1c1a0ccdcdbc29 /tests/framework/Framework.cpp
parent6f4d49f95c3598e41a7532faa637f42d8be5f4dd (diff)
downloadComputeLibrary-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/Framework.cpp')
-rw-r--r--tests/framework/Framework.cpp17
1 files changed, 10 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)