blob: 2da2c99874ecf6faf4cdcf73ac195012f06dccac [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"
28#include "CommandLineOptions.h"
29#include <memory>
30
31namespace arm_compute
32{
33namespace test
34{
35namespace framework
36{
37class CommandLineParser;
38class Printer;
39enum class LogFormat;
40enum class LogLevel;
41
42/** Common command line options used to configure the framework
43 *
44 * The options in this object get populated when "parse()" is called on the parser used to construct it.
45 * The expected workflow is:
46 *
47 * CommandLineParser parser;
48 * CommonOptions options( parser );
49 * parser.parse(argc, argv);
50 * if(options.log_level->value() > LogLevel::NONE) --> Use the options values
51 */
52class CommonOptions
53{
54public:
55 /** Constructor
56 *
57 * @param[in,out] parser A parser on which "parse()" hasn't been called yet.
58 */
59 CommonOptions(CommandLineParser &parser);
60 CommonOptions(const CommonOptions &) = delete;
61 CommonOptions &operator=(const CommonOptions &) = delete;
62 /** Create the printers based on parsed command line options
63 *
64 * @pre "parse()" has been called on the parser used to construct this object
65 *
66 * @return List of printers
67 */
68 std::vector<std::unique_ptr<Printer>> create_printers();
69
70 ToggleOption *help;
71 EnumListOption<InstrumentsDescription> *instruments;
72 SimpleOption<int> *iterations;
73 SimpleOption<int> *threads;
74 EnumOption<LogFormat> *log_format;
75 SimpleOption<std::string> *log_file;
76 EnumOption<LogLevel> *log_level;
77 ToggleOption *throw_errors;
78 ToggleOption *color_output;
79 ToggleOption *pretty_console;
80 SimpleOption<std::string> *json_file;
81 SimpleOption<std::string> *pretty_file;
82 std::vector<std::shared_ptr<std::ofstream>> log_streams;
83};
84
85} // namespace framework
86} // namespace test
87} // namespace arm_compute
88#endif /* ARM_COMPUTE_TEST_COMMONOPTIONS */