aboutsummaryrefslogtreecommitdiff
path: root/tests/main.cpp
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-07-24 15:52:54 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commit2ac5040c9b21734610b51b232ddac5a9067aa2c2 (patch)
tree6904b4c587cf0c5ebab4f8b05113bc8eb397b948 /tests/main.cpp
parentbf234e0c5d2af80f89fffcd963e5e2c455bcf3f1 (diff)
downloadComputeLibrary-2ac5040c9b21734610b51b232ddac5a9067aa2c2.tar.gz
COMPMID-415: Add log level
Change-Id: I93f49198ab2c32f52b4723a0624d588683a92451 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81446 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/main.cpp')
-rw-r--r--tests/main.cpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index e60aad4d86..4f17685098 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -22,6 +22,8 @@
* SOFTWARE.
*/
#include "framework/DatasetModes.h"
+#include "framework/Exceptions.h"
+#include "framework/Framework.h"
#include "framework/Macros.h"
#include "framework/command_line/CommandLineOptions.h"
#include "framework/command_line/CommandLineParser.h"
@@ -88,6 +90,17 @@ int main(int argc, char **argv)
framework::LogFormat::JSON,
};
+ std::set<framework::LogLevel> supported_log_levels
+ {
+ framework::LogLevel::NONE,
+ framework::LogLevel::CONFIG,
+ framework::LogLevel::TESTS,
+ framework::LogLevel::ERRORS,
+ framework::LogLevel::DEBUG,
+ framework::LogLevel::MEASUREMENTS,
+ framework::LogLevel::ALL,
+ };
+
auto help = parser.add_option<framework::ToggleOption>("help");
help->set_help("Show this help message");
auto dataset_mode = parser.add_option<framework::EnumOption<framework::DatasetMode>>("mode", allowed_modes, framework::DatasetMode::ALL);
@@ -106,6 +119,8 @@ int main(int argc, char **argv)
filter_id->set_help("Test id. Only this test will be executed.");
auto log_file = parser.add_option<framework::SimpleOption<std::string>>("log-file");
log_file->set_help("Write output to file instead of to the console");
+ auto log_level = parser.add_option<framework::EnumOption<framework::LogLevel>>("log-level", supported_log_levels, framework::LogLevel::ALL);
+ log_file->set_help("Verbosity of the output");
auto throw_errors = parser.add_option<framework::ToggleOption>("throw-errors");
throw_errors->set_help("Don't catch errors (useful for debugging)");
auto seed = parser.add_option<framework::SimpleOption<std::random_device::result_type>>("seed", std::random_device()());
@@ -159,16 +174,23 @@ int main(int argc, char **argv)
Scheduler::get().set_num_threads(threads->value());
- printer->print_global_header();
- printer->print_entry("Seed", support::cpp11::to_string(seed->value()));
- printer->print_entry("Iterations", support::cpp11::to_string(iterations->value()));
- printer->print_entry("Threads", support::cpp11::to_string(threads->value()));
+ if(log_level->value() > framework::LogLevel::NONE)
+ {
+ printer->print_global_header();
+ }
+
+ if(log_level->value() >= framework::LogLevel::CONFIG)
{
- using support::cpp11::to_string;
- printer->print_entry("Dataset mode", to_string(dataset_mode->value()));
+ printer->print_entry("Seed", support::cpp11::to_string(seed->value()));
+ printer->print_entry("Iterations", support::cpp11::to_string(iterations->value()));
+ printer->print_entry("Threads", support::cpp11::to_string(threads->value()));
+ {
+ using support::cpp11::to_string;
+ printer->print_entry("Dataset mode", to_string(dataset_mode->value()));
+ }
}
- framework.init(instruments->value(), iterations->value(), dataset_mode->value(), filter->value(), filter_id->value());
+ framework.init(instruments->value(), iterations->value(), dataset_mode->value(), filter->value(), filter_id->value(), log_level->value());
framework.set_printer(printer.get());
framework.set_throw_errors(throw_errors->value());
@@ -193,7 +215,10 @@ int main(int argc, char **argv)
success = framework.run();
- printer->print_global_footer();
+ if(log_level->value() > framework::LogLevel::NONE)
+ {
+ printer->print_global_footer();
+ }
return (success ? 0 : 1);
}