From 7b8149cfd43e2d67bbde84f02b52a30ecf9576aa Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Tue, 20 Jun 2017 15:49:45 -0700 Subject: [PATCH] Move benchmarks to a separate project --- test/CMakeLists.txt | 1 + test/Jamfile | 1 + test/benchmarks/CMakeLists.txt | 27 +++++++++++++++++++ test/benchmarks/Jamfile | 15 +++++++++++ .../buffers.cpp} | 6 ++--- .../nodejs-parser/AUTHORS | 0 .../nodejs-parser/LICENSE-MIT | 0 .../nodejs-parser/README.md | 0 .../nodejs-parser/http_parser.c | 0 .../nodejs-parser/http_parser.h | 0 test/{http => benchmarks}/nodejs_parser.cpp | 0 test/{http => benchmarks}/nodejs_parser.hpp | 0 .../parser.cpp} | 6 ++--- test/core/CMakeLists.txt | 1 - test/core/Jamfile | 1 - test/http/CMakeLists.txt | 18 ------------- test/http/Jamfile | 6 ----- 17 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 test/benchmarks/CMakeLists.txt create mode 100644 test/benchmarks/Jamfile rename test/{core/buffer_bench.cpp => benchmarks/buffers.cpp} (97%) rename test/{http => benchmarks}/nodejs-parser/AUTHORS (100%) rename test/{http => benchmarks}/nodejs-parser/LICENSE-MIT (100%) rename test/{http => benchmarks}/nodejs-parser/README.md (100%) rename test/{http => benchmarks}/nodejs-parser/http_parser.c (100%) rename test/{http => benchmarks}/nodejs-parser/http_parser.h (100%) rename test/{http => benchmarks}/nodejs_parser.cpp (100%) rename test/{http => benchmarks}/nodejs_parser.hpp (100%) rename test/{http/parser_bench.cpp => benchmarks/parser.cpp} (98%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ee3afd42..701c9687 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,6 @@ # Part of Beast +add_subdirectory (benchmarks) add_subdirectory (core) add_subdirectory (http) add_subdirectory (server) diff --git a/test/Jamfile b/test/Jamfile index 415b4d04..05a83958 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -14,6 +14,7 @@ compile version.cpp : coverage:no : ; compile websocket.cpp : coverage:no : ; compile zlib.cpp : coverage:no : ; +build-project benchmarks ; build-project core ; build-project http ; build-project server ; diff --git a/test/benchmarks/CMakeLists.txt b/test/benchmarks/CMakeLists.txt new file mode 100644 index 00000000..59773639 --- /dev/null +++ b/test/benchmarks/CMakeLists.txt @@ -0,0 +1,27 @@ +# Part of Beast + +if (NOT "${VARIANT}" STREQUAL "coverage") + + GroupSources(extras/beast extras) + GroupSources(include/beast beast) + GroupSources(test/benchmarks "/") + GroupSources(test/http "/") + + add_executable (benchmarks + ${BEAST_INCLUDES} + ${EXTRAS_INCLUDES} + ../../extras/beast/unit_test/main.cpp + ../http/message_fuzz.hpp + nodejs_parser.hpp + buffers.cpp + nodejs_parser.cpp + parser.cpp + ) + + target_link_libraries(benchmarks + Beast + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_FILESYSTEM_LIBRARY} + ) + +endif() diff --git a/test/benchmarks/Jamfile b/test/benchmarks/Jamfile new file mode 100644 index 00000000..65bfd34f --- /dev/null +++ b/test/benchmarks/Jamfile @@ -0,0 +1,15 @@ +# +# Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) +# +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# + +unit-test benchmarks : + ../../extras/beast/unit_test/main.cpp + buffers.cpp + nodejs_parser.cpp + parser.cpp + : + coverage:no + ; diff --git a/test/core/buffer_bench.cpp b/test/benchmarks/buffers.cpp similarity index 97% rename from test/core/buffer_bench.cpp rename to test/benchmarks/buffers.cpp index 8e22d5d6..426cea34 100644 --- a/test/core/buffer_bench.cpp +++ b/test/benchmarks/buffers.cpp @@ -20,7 +20,7 @@ namespace beast { -class buffer_bench_test : public beast::unit_test::suite +class buffers_test : public beast::unit_test::suite { public: using size_type = std::uint64_t; @@ -233,8 +233,6 @@ public: } }; -#if defined(NDEBUG) && ! BEAST_NO_SLOW_TESTS -BEAST_DEFINE_TESTSUITE(buffer_bench,core,beast); -#endif +BEAST_DEFINE_TESTSUITE(buffers,benchmarks,beast); } // beast diff --git a/test/http/nodejs-parser/AUTHORS b/test/benchmarks/nodejs-parser/AUTHORS similarity index 100% rename from test/http/nodejs-parser/AUTHORS rename to test/benchmarks/nodejs-parser/AUTHORS diff --git a/test/http/nodejs-parser/LICENSE-MIT b/test/benchmarks/nodejs-parser/LICENSE-MIT similarity index 100% rename from test/http/nodejs-parser/LICENSE-MIT rename to test/benchmarks/nodejs-parser/LICENSE-MIT diff --git a/test/http/nodejs-parser/README.md b/test/benchmarks/nodejs-parser/README.md similarity index 100% rename from test/http/nodejs-parser/README.md rename to test/benchmarks/nodejs-parser/README.md diff --git a/test/http/nodejs-parser/http_parser.c b/test/benchmarks/nodejs-parser/http_parser.c similarity index 100% rename from test/http/nodejs-parser/http_parser.c rename to test/benchmarks/nodejs-parser/http_parser.c diff --git a/test/http/nodejs-parser/http_parser.h b/test/benchmarks/nodejs-parser/http_parser.h similarity index 100% rename from test/http/nodejs-parser/http_parser.h rename to test/benchmarks/nodejs-parser/http_parser.h diff --git a/test/http/nodejs_parser.cpp b/test/benchmarks/nodejs_parser.cpp similarity index 100% rename from test/http/nodejs_parser.cpp rename to test/benchmarks/nodejs_parser.cpp diff --git a/test/http/nodejs_parser.hpp b/test/benchmarks/nodejs_parser.hpp similarity index 100% rename from test/http/nodejs_parser.hpp rename to test/benchmarks/nodejs_parser.hpp diff --git a/test/http/parser_bench.cpp b/test/benchmarks/parser.cpp similarity index 98% rename from test/http/parser_bench.cpp rename to test/benchmarks/parser.cpp index 9c5a5a33..abe7c6a9 100644 --- a/test/http/parser_bench.cpp +++ b/test/benchmarks/parser.cpp @@ -6,7 +6,7 @@ // #include "nodejs_parser.hpp" -#include "message_fuzz.hpp" +#include "../http/message_fuzz.hpp" #include #include @@ -22,7 +22,7 @@ namespace beast { namespace http { -class parser_bench_test : public beast::unit_test::suite +class parser_test : public beast::unit_test::suite { public: static std::size_t constexpr N = 2000; @@ -270,7 +270,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(parser_bench,http,beast); +BEAST_DEFINE_TESTSUITE(parser,benchmarks,beast); } // http } // beast diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index acc16863..19134425 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -12,7 +12,6 @@ add_executable (core-tests ../../extras/beast/unit_test/main.cpp async_result.cpp bind_handler.cpp - buffer_bench.cpp buffer_cat.cpp buffer_prefix.cpp buffer_test.hpp diff --git a/test/core/Jamfile b/test/core/Jamfile index cbd6c7f2..ab2d5a2a 100644 --- a/test/core/Jamfile +++ b/test/core/Jamfile @@ -9,7 +9,6 @@ unit-test core-tests : ../../extras/beast/unit_test/main.cpp async_result.cpp bind_handler.cpp - buffer_bench.cpp buffer_cat.cpp buffer_prefix.cpp buffered_read_stream.cpp diff --git a/test/http/CMakeLists.txt b/test/http/CMakeLists.txt index 630230eb..670ef3ae 100644 --- a/test/http/CMakeLists.txt +++ b/test/http/CMakeLists.txt @@ -43,21 +43,3 @@ target_link_libraries(http-tests ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY} ) - -if (NOT "${VARIANT}" STREQUAL "coverage") - add_executable (http-bench - ${BEAST_INCLUDES} - ${EXTRAS_INCLUDES} - nodejs_parser.hpp - message_fuzz.hpp - ../../extras/beast/unit_test/main.cpp - nodejs_parser.cpp - parser_bench.cpp - ) - - target_link_libraries(http-bench - Beast - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Boost_FILESYSTEM_LIBRARY} - ) -endif() diff --git a/test/http/Jamfile b/test/http/Jamfile index 5e22e1a9..9a87fdcd 100644 --- a/test/http/Jamfile +++ b/test/http/Jamfile @@ -27,9 +27,3 @@ unit-test http-tests : verb.cpp write.cpp ; - -unit-test http-bench : - ../../extras/beast/unit_test/main.cpp - nodejs_parser.cpp - parser_bench.cpp - ;