blob: f4646a0299308fa98400e61d41d652de891d6884 [file] [log] [blame]
Anthony Barbier6db0ff52018-01-05 10:59:12 +00001/*
2 * Copyright (c) 2018 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef ARM_COMPUTE_TEST_COMMONOPTIONS
25#define ARM_COMPUTE_TEST_COMMONOPTIONS
26
27#include "../instruments/Instruments.h"
Georgios Pinitas12be7ab2018-07-03 12:06:23 +010028
29#include "utils/command_line/CommandLineOptions.h"
30#include "utils/command_line/CommandLineParser.h"
31
Anthony Barbier6db0ff52018-01-05 10:59:12 +000032#include <memory>
33
34namespace arm_compute
35{
36namespace test
37{
38namespace framework
39{
Anthony Barbier6db0ff52018-01-05 10:59:12 +000040class Printer;
41enum class LogFormat;
42enum class LogLevel;
43
44/** Common command line options used to configure the framework
Alex Gildayc357c472018-03-21 13:54:09 +000045 *
46 * The options in this object get populated when "parse()" is called on the parser used to construct it.
47 * The expected workflow is:
48 *
49 * CommandLineParser parser;
50 * CommonOptions options( parser );
51 * parser.parse(argc, argv);
52 * if(options.log_level->value() > LogLevel::NONE) --> Use the options values
53 */
Anthony Barbier6db0ff52018-01-05 10:59:12 +000054class CommonOptions
55{
56public:
57 /** Constructor
58 *
59 * @param[in,out] parser A parser on which "parse()" hasn't been called yet.
60 */
Georgios Pinitas12be7ab2018-07-03 12:06:23 +010061 CommonOptions(arm_compute::utils::CommandLineParser &parser);
Alex Gildayc357c472018-03-21 13:54:09 +000062 /** Prevent instances of this class from being copy constructed */
Anthony Barbier6db0ff52018-01-05 10:59:12 +000063 CommonOptions(const CommonOptions &) = delete;
Alex Gildayc357c472018-03-21 13:54:09 +000064 /** Prevent instances of this class from being copied */
Anthony Barbier6db0ff52018-01-05 10:59:12 +000065 CommonOptions &operator=(const CommonOptions &) = delete;
66 /** Create the printers based on parsed command line options
67 *
68 * @pre "parse()" has been called on the parser used to construct this object
69 *
70 * @return List of printers
71 */
72 std::vector<std::unique_ptr<Printer>> create_printers();
73
Georgios Pinitas12be7ab2018-07-03 12:06:23 +010074 arm_compute::utils::ToggleOption *help; /**< Show help option */
75 arm_compute::utils::EnumListOption<InstrumentsDescription> *instruments; /**< Instruments option */
76 arm_compute::utils::SimpleOption<int> *iterations; /**< Number of iterations option */
Georgios Pinitas12be7ab2018-07-03 12:06:23 +010077 arm_compute::utils::EnumOption<LogFormat> *log_format; /**< Log format option */
78 arm_compute::utils::SimpleOption<std::string> *log_file; /**< Log file option */
79 arm_compute::utils::EnumOption<LogLevel> *log_level; /**< Logging level option */
80 arm_compute::utils::ToggleOption *throw_errors; /**< Throw errors option */
81 arm_compute::utils::ToggleOption *color_output; /**< Color output option */
82 arm_compute::utils::ToggleOption *pretty_console; /**< Pretty console option */
83 arm_compute::utils::SimpleOption<std::string> *json_file; /**< JSON output file option */
84 arm_compute::utils::SimpleOption<std::string> *pretty_file; /**< Pretty output file option */
85 std::vector<std::shared_ptr<std::ofstream>> log_streams; /**< Log streams */
Anthony Barbier6db0ff52018-01-05 10:59:12 +000086};
87
88} // namespace framework
89} // namespace test
90} // namespace arm_compute
91#endif /* ARM_COMPUTE_TEST_COMMONOPTIONS */