From bb2e402bc76fc2a66c868a7c9a92261058e373dd Mon Sep 17 00:00:00 2001 From: John Beard Date: Mon, 24 Dec 2018 14:43:08 +0000 Subject: [PATCH] QA: Move io_benchmark into common_tools --- qa/common_tools/CMakeLists.txt | 2 ++ qa/common_tools/main.cpp | 2 ++ .../tools}/io_benchmark/io_benchmark.cpp | 21 +++++++------ .../tools/io_benchmark/io_benchmark.h | 31 +++++++++++++++++++ tools/CMakeLists.txt | 3 -- tools/io_benchmark/CMakeLists.txt | 17 ---------- 6 files changed, 47 insertions(+), 29 deletions(-) rename {tools => qa/common_tools/tools}/io_benchmark/io_benchmark.cpp (97%) create mode 100644 qa/common_tools/tools/io_benchmark/io_benchmark.h delete mode 100644 tools/io_benchmark/CMakeLists.txt diff --git a/qa/common_tools/CMakeLists.txt b/qa/common_tools/CMakeLists.txt index 6c033b02ac..2842cd2b33 100644 --- a/qa/common_tools/CMakeLists.txt +++ b/qa/common_tools/CMakeLists.txt @@ -34,6 +34,8 @@ add_executable( qa_common_tools main.cpp tools/coroutines/coroutines.cpp + + tools/io_benchmark/io_benchmark.cpp ) include_directories( diff --git a/qa/common_tools/main.cpp b/qa/common_tools/main.cpp index 64ca80eec5..1733b6184a 100644 --- a/qa/common_tools/main.cpp +++ b/qa/common_tools/main.cpp @@ -24,6 +24,7 @@ #include #include "tools/coroutines/coroutine_tools.h" +#include "tools/io_benchmark/io_benchmark.h" #include @@ -35,6 +36,7 @@ */ const static std::vector known_tools = { &coroutine_tool, + &io_benchmark_tool, }; diff --git a/tools/io_benchmark/io_benchmark.cpp b/qa/common_tools/tools/io_benchmark/io_benchmark.cpp similarity index 97% rename from tools/io_benchmark/io_benchmark.cpp rename to qa/common_tools/tools/io_benchmark/io_benchmark.cpp index 0c11a96c30..ce919c01d1 100644 --- a/tools/io_benchmark/io_benchmark.cpp +++ b/qa/common_tools/tools/io_benchmark/io_benchmark.cpp @@ -21,6 +21,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "io_benchmark.h" + #include #include @@ -377,13 +379,7 @@ BENCH_REPORT executeBenchMark( const BENCHMARK& aBenchmark, int aReps, } -enum RET_CODES -{ - BAD_ARGS = 1, -}; - - -int main( int argc, char* argv[] ) +int io_benchmark_func( int argc, char* argv[] ) { auto& os = std::cout; @@ -392,7 +388,7 @@ int main( int argc, char* argv[] ) os << "Usage: " << argv[0] << " [" << getBenchFlags() << "]\n\n"; os << "Benchmarks:\n"; os << getBenchDescriptions(); - return BAD_ARGS; + return RET_CODES::BAD_CMDLINE; } wxFileName inFile( argv[1] ); @@ -423,5 +419,12 @@ int main( int argc, char* argv[] ) << std::endl;; } - return 0; + return RET_CODES::OK; } + + +UTILITY_PROGRAM io_benchmark_tool = { + "io_benchmark", + "Benchmark various kinds of IO methods", + io_benchmark_func, +}; \ No newline at end of file diff --git a/qa/common_tools/tools/io_benchmark/io_benchmark.h b/qa/common_tools/tools/io_benchmark/io_benchmark.h new file mode 100644 index 0000000000..e3493a80d7 --- /dev/null +++ b/qa/common_tools/tools/io_benchmark/io_benchmark.h @@ -0,0 +1,31 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef IO_BENCHMARK_H +#define IO_BENCHMARK_H + +#include + +extern UTILITY_PROGRAM io_benchmark_tool; + +#endif // IO_BENCHMARK_H \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 40a27018f6..46c9744faf 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -45,6 +45,3 @@ target_link_libraries( utf8_tests common ${wxWidgets_LIBRARIES} ) - - -add_subdirectory( io_benchmark ) diff --git a/tools/io_benchmark/CMakeLists.txt b/tools/io_benchmark/CMakeLists.txt deleted file mode 100644 index bbab2a9c68..0000000000 --- a/tools/io_benchmark/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -include_directories( BEFORE ${INC_BEFORE} ) - -set( IOBENCHMARK_SRCS - io_benchmark.cpp -) - -add_executable( io_benchmark - ${IOBENCHMARK_SRCS} -) - -target_link_libraries( io_benchmark - common - qa_utils - ${wxWidgets_LIBRARIES} -) -