aboutsummaryrefslogtreecommitdiff
path: root/framework/Framework.cpp
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-07-05 11:02:37 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:15:39 +0100
commit80fffae1419b8286c5a62412a405ed42540ef4d3 (patch)
tree2ddc4f588ec28abbc42328bcf18c4cdfc31fefda /framework/Framework.cpp
parenta4f711b0fa38aecf0aacdbf61acf86bd25aa674a (diff)
downloadComputeLibrary-80fffae1419b8286c5a62412a405ed42540ef4d3.tar.gz
COMPMID-415: New framework - printers [4/5]
Change-Id: Ibbaced7b01c16361843f4381fbf6cd15a4487062 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79758 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'framework/Framework.cpp')
-rw-r--r--framework/Framework.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/framework/Framework.cpp b/framework/Framework.cpp
index 692e17cb91..72fa1981fc 100644
--- a/framework/Framework.cpp
+++ b/framework/Framework.cpp
@@ -123,7 +123,10 @@ void Framework::pop_suite()
void Framework::log_test_start(const std::string &test_name)
{
- static_cast<void>(test_name);
+ if(_printer != nullptr)
+ {
+ _printer->print_test_header(test_name);
+ }
}
void Framework::log_test_skipped(const std::string &test_name)
@@ -133,7 +136,11 @@ void Framework::log_test_skipped(const std::string &test_name)
void Framework::log_test_end(const std::string &test_name)
{
- static_cast<void>(test_name);
+ if(_printer != nullptr)
+ {
+ _printer->print_measurements(_test_results.at(test_name).measurements);
+ _printer->print_test_footer();
+ }
}
void Framework::log_failed_expectation(const std::string &msg)
@@ -256,6 +263,11 @@ bool Framework::run()
_test_results.clear();
_runtime = std::chrono::seconds{ 0 };
+ if(_printer != nullptr)
+ {
+ _printer->print_run_header();
+ }
+
const auto start = std::chrono::high_resolution_clock::now();
int id = 0;
@@ -278,6 +290,11 @@ bool Framework::run()
const auto end = std::chrono::high_resolution_clock::now();
+ if(_printer != nullptr)
+ {
+ _printer->print_run_footer();
+ }
+
_runtime = std::chrono::duration_cast<std::chrono::seconds>(end - start);
int passed = 0;
@@ -296,6 +313,20 @@ void Framework::set_test_result(std::string test_case_name, TestResult result)
_test_results.emplace(std::move(test_case_name), std::move(result));
}
+void Framework::print_test_results(Printer &printer) const
+{
+ printer.print_run_header();
+
+ for(const auto &test : _test_results)
+ {
+ printer.print_test_header(test.first);
+ printer.print_measurements(test.second.measurements);
+ printer.print_test_footer();
+ }
+
+ printer.print_run_footer();
+}
+
Profiler Framework::get_profiler() const
{
Profiler profiler;
@@ -311,6 +342,11 @@ Profiler Framework::get_profiler() const
return profiler;
}
+void Framework::set_printer(Printer *printer)
+{
+ _printer = printer;
+}
+
std::vector<Framework::TestId> Framework::test_ids() const
{
std::vector<TestId> ids;