aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2017-11-24 11:24:45 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:41:04 +0000
commitdbfb31cdee063ec61e0ab1087f99f235c12d2e7e (patch)
tree6076e31984b4278cbba7ca2c1bc53fa258e98842
parentc8097129aca9e410ec1fe0ff8f568db7a89b7cd2 (diff)
downloadComputeLibrary-dbfb31cdee063ec61e0ab1087f99f235c12d2e7e.tar.gz
COMPMID-556 Print tests list using printers rather than cout
Will help with scripting to split the tests to run across several boards Change-Id: I32806c3cd03cd1b4af1865cd4fdb0422d609eff0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/110535 Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
-rw-r--r--tests/framework/printers/JSONPrinter.cpp15
-rw-r--r--tests/framework/printers/JSONPrinter.h1
-rw-r--r--tests/framework/printers/PrettyPrinter.cpp7
-rw-r--r--tests/framework/printers/PrettyPrinter.h1
-rw-r--r--tests/framework/printers/Printer.h5
-rw-r--r--tests/main.cpp5
6 files changed, 32 insertions, 2 deletions
diff --git a/tests/framework/printers/JSONPrinter.cpp b/tests/framework/printers/JSONPrinter.cpp
index 8d3c023a92..676ec69336 100644
--- a/tests/framework/printers/JSONPrinter.cpp
+++ b/tests/framework/printers/JSONPrinter.cpp
@@ -113,6 +113,21 @@ void JSONPrinter::print_test_footer()
*_stream << "}";
}
+void JSONPrinter::print_list_tests(const std::vector<TestInfo> &infos)
+{
+ *_stream << R"(, "list_tests" : {)";
+ bool first = true;
+ for(auto info : infos)
+ {
+ if(!first)
+ {
+ *_stream << ",";
+ }
+ *_stream << R"(")" << info.id << R"(" : { "name": ")" << info.name << R"(", "mode": ")" << info.mode << R"(", "status" : ")" << info.status << R"(" })";
+ first = false;
+ }
+ *_stream << "}";
+}
void JSONPrinter::print_errors_header()
{
_errors.clear();
diff --git a/tests/framework/printers/JSONPrinter.h b/tests/framework/printers/JSONPrinter.h
index a2811ea41b..3b783ac64f 100644
--- a/tests/framework/printers/JSONPrinter.h
+++ b/tests/framework/printers/JSONPrinter.h
@@ -52,6 +52,7 @@ public:
void print_error(const std::exception &error, bool expected) override;
void print_info(const std::string &info) override;
void print_measurements(const Profiler::MeasurementsMap &measurements) override;
+ void print_list_tests(const std::vector<TestInfo> &infos) override;
private:
void print_separator(bool &flag);
diff --git a/tests/framework/printers/PrettyPrinter.cpp b/tests/framework/printers/PrettyPrinter.cpp
index 280813f044..a2ce821f6b 100644
--- a/tests/framework/printers/PrettyPrinter.cpp
+++ b/tests/framework/printers/PrettyPrinter.cpp
@@ -108,6 +108,13 @@ void PrettyPrinter::print_error(const std::exception &error, bool expected)
*_stream << begin_color("1") << prefix << error.what() << end_color() << "\n";
}
+void PrettyPrinter::print_list_tests(const std::vector<TestInfo> &infos)
+{
+ for(auto info : infos)
+ {
+ *_stream << "[" << info.id << ", " << info.mode << ", " << info.status << "] " << info.name << "\n";
+ }
+}
void PrettyPrinter::print_measurements(const Profiler::MeasurementsMap &measurements)
{
for(const auto &instrument : measurements)
diff --git a/tests/framework/printers/PrettyPrinter.h b/tests/framework/printers/PrettyPrinter.h
index f72a613868..95487f94c5 100644
--- a/tests/framework/printers/PrettyPrinter.h
+++ b/tests/framework/printers/PrettyPrinter.h
@@ -56,6 +56,7 @@ public:
void print_error(const std::exception &error, bool expected) override;
void print_info(const std::string &info) override;
void print_measurements(const Profiler::MeasurementsMap &measurements) override;
+ void print_list_tests(const std::vector<TestInfo> &infos) override;
private:
std::string begin_color(const std::string &color) const;
diff --git a/tests/framework/printers/Printer.h b/tests/framework/printers/Printer.h
index c2a44240ba..cb0aa1e4c2 100644
--- a/tests/framework/printers/Printer.h
+++ b/tests/framework/printers/Printer.h
@@ -102,6 +102,11 @@ public:
/** Print footer after errors. */
virtual void print_errors_footer() = 0;
+ /** Print the list of all the tests
+ *
+ * @param[in] infos List of tests to print
+ */
+ virtual void print_list_tests(const std::vector<TestInfo> &infos) = 0;
/** Print test error.
*
* @param[in] error Description of the error.
diff --git a/tests/main.cpp b/tests/main.cpp
index 73c87b5459..c62de66588 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -254,9 +254,10 @@ int main(int argc, char **argv)
if(list_tests->value())
{
- for(const auto &info : framework.test_infos())
+ for(auto &p : printers)
{
- std::cout << "[" << info.id << ", " << info.mode << ", " << info.status << "] " << info.name << "\n";
+ p->print_list_tests(framework.test_infos());
+ p->print_global_footer();
}
return 0;