diff --git a/CHANGELOG.md b/CHANGELOG.md index 8039f6b8..f8731ebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Version 87: * variant fixes and tests * Update README, add CONTRIBUTING.md and CODE_OF_CONDUCT.md * Update doc links in README.md +* Refactor tests Jamfile -------------------------------------------------------------------------------- diff --git a/Jamfile b/Jamfile index 8cd2bcdd..e835b1fe 100644 --- a/Jamfile +++ b/Jamfile @@ -13,6 +13,8 @@ import boost ; import modules ; import testing ; +#import ../config/checks/config : requires ; + boost.use-project ; if [ os.name ] = SOLARIS @@ -64,14 +66,17 @@ variant ubasan "-fsanitize=address,undefined" ; +#local REQ = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_hdr_type_traits cxx11_hdr_tuple ] ; + project beast : requirements + #$(REQ) /boost//headers . ./extras #/boost//headers /boost/system//boost_system - /boost/coroutine//boost_coroutine + /boost/coroutine//boost_coroutine/BOOST_COROUTINES_NO_DEPRECATION_WARNING=1 /boost/filesystem//boost_filesystem /boost/program_options//boost_program_options BOOST_ALL_NO_LIB=1 @@ -84,20 +89,12 @@ project beast BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1 BOOST_ASIO_DISABLE_BOOST_REGEX=1 gcc:-std=c++11 - gcc:-Wno-unused-parameter - gcc:-Wno-unused-variable # Temporary until we can figure out -isystem clang:-std=c++11 - clang:-Wno-unused-parameter - clang:-Wno-unused-variable # Temporary until we can figure out -isystem clang:-Wrange-loop-analysis msvc:_SCL_SECURE_NO_WARNINGS=1 msvc:_CRT_SECURE_NO_WARNINGS=1 msvc:"/permissive- /bigobj" msvc:release:"/Ob2 /Oi /Ot" - LINUX:_XOPEN_SOURCE=600 - LINUX:_GNU_SOURCE=1 - SOLARIS:_XOPEN_SOURCE=500 - SOLARIS:__EXTENSIONS__ SOLARIS:socket SOLARIS:nsl NT:_WIN32_WINNT=0x0601 @@ -107,5 +104,4 @@ project beast NT,gcc:mswsock NT,gcc-cygwin:__USE_W32_SOCKETS : usage-requirements - : ; diff --git a/scripts/build-and-test.sh b/scripts/build-and-test.sh index d8783244..da24a431 100755 --- a/scripts/build-and-test.sh +++ b/scripts/build-and-test.sh @@ -65,19 +65,19 @@ echo "using BOOST_ROOT: $BOOST_ROOT" #################################### HELPERS ################################### function run_tests_with_debugger { - for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/*-tests; do + for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/build-fat; do "$LIB_DIR/scripts/run-with-debugger.sh" "$x" done } function run_tests { - for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/*-tests; do + for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/build-fat; do $x done } function run_tests_with_valgrind { - for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/*-tests; do + for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/build-fat; do if [[ $(basename $x) == "bench-tests" ]]; then $x else @@ -89,8 +89,13 @@ function run_tests_with_valgrind { } function build_bjam { - bjam libs/beast/test toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} - bjam libs/beast/example toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} + if [[ $VARIANT == "coverage" ]]; then + bjam libs/beast/test//build-fat toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} + + else + bjam libs/beast/test//build-fat toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} + bjam libs/beast/example toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} + fi } function build_cmake { @@ -151,13 +156,13 @@ if [[ $VARIANT == "coverage" ]]; then lcov --no-external -c -i -d "$BOOST_ROOT" -o baseline.info > /dev/null # Perform test - if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then - run_tests_with_valgrind - #run_autobahn_test_suite # skip slow autobahn tests - else - echo "skipping autobahn/valgrind tests for feature branch build" + #if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then + # run_tests_with_valgrind + # #run_autobahn_test_suite # skip slow autobahn tests + #else + # echo "skipping autobahn/valgrind tests for feature branch build" run_tests - fi + #fi # Create test coverage data file, combine with the # baseline result and filter out things we don't want. diff --git a/test/Jamfile b/test/Jamfile index c20230d3..bd4e5293 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -9,32 +9,47 @@ import os ; -compile config.cpp : coverage:no - ubasan:no : ; +path-constant TEST_MAIN : ../extras/boost/beast/unit_test/main.cpp ; -compile core.cpp : coverage:no - ubasan:no : ; +compile config.cpp : coverage:no ubasan:no ; +compile core.cpp : coverage:no ubasan:no ; +compile exemplars.cpp : coverage:no ubasan:no ; +compile http.cpp : coverage:no ubasan:no ; +compile version.cpp : coverage:no ubasan:no ; +compile websocket.cpp : coverage:no ubasan:no ; +compile zlib.cpp : coverage:no ubasan:no ; -compile exemplars.cpp : coverage:no - ubasan:no : ; +alias run-tests : + #benchmarks//run-tests # not necessary + common//run-tests + core//run-tests + http//run-tests + server//run-tests + websocket//run-tests + wstest//run-tests + zlib//run-tests + ; -compile http.cpp : coverage:no - ubasan:no : ; +alias run-fat : + benchmarks//run-fat + common//run-fat + core//run-fat + http//run-fat + server//run-fat + websocket//run-fat + #wstest//run-fat # not available + zlib//run-fat + ; +explicit run-fat ; -compile version.cpp : coverage:no - ubasan:no : ; - -compile websocket.cpp : coverage:no - ubasan:no : ; - -compile zlib.cpp : coverage:no - ubasan:no : ; - -build-project benchmarks ; -build-project common ; -build-project core ; -build-project http ; -build-project server ; -build-project websocket ; -build-project wstest ; -build-project zlib ; +alias build-fat : + benchmarks//build-fat + common//build-fat + core//build-fat + http//build-fat + server//build-fat + websocket//build-fat + #wstest//build-fat # not available + zlib//build-fat + ; +explicit build-fat ; diff --git a/test/benchmarks/Jamfile b/test/benchmarks/Jamfile index 26571f97..579745e8 100644 --- a/test/benchmarks/Jamfile +++ b/test/benchmarks/Jamfile @@ -7,13 +7,15 @@ # Official repository: https://github.com/boostorg/beast # -unit-test benchmarks : - ../../extras/boost/beast/unit_test/main.cpp +local SOURCES = buffers.cpp nodejs_parser.cpp parser.cpp #utf8_checker.cpp # causes unnecessary dependencies - : - coverage:no - ubasan:no ; + +unit-test run-fat : $(TEST_MAIN) $(SOURCES) : : : coverage:no ubasan:no ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(SOURCES) : : : coverage:no ubasan:no ; +explicit build-fat ; diff --git a/test/common/Jamfile b/test/common/Jamfile index bd079d74..8194e0a4 100644 --- a/test/common/Jamfile +++ b/test/common/Jamfile @@ -7,15 +7,20 @@ # Official repository: https://github.com/boostorg/beast # -exe common-test : +local SOURCES = detect_ssl.cpp mime_types.cpp rfc7231.cpp session_alloc.cpp ssl_stream.cpp write_msg.cpp - main.cpp - : - coverage:no - ubasan:no ; + +local RUN_TESTS ; for local f in $(SOURCES) { RUN_TESTS += [ compile $(f) ] ; } +alias run-tests : $(RUN_TESTS) : : : coverage:no ubasan:no ; + +unit-test run-fat : main.cpp $(SOURCES) : : : coverage:no ubasan:no ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(SOURCES) : : : coverage:no ubasan:no ; +explicit build-fat ; diff --git a/test/core/Jamfile b/test/core/Jamfile index a157cdc9..8d97169e 100644 --- a/test/core/Jamfile +++ b/test/core/Jamfile @@ -7,8 +7,7 @@ # Official repository: https://github.com/boostorg/beast # -unit-test core-tests : - ../../extras/boost/beast/unit_test/main.cpp +local SOURCES = async_result.cpp bind_handler.cpp buffer_cat.cpp @@ -44,3 +43,12 @@ unit-test core-tests : detail/variant.cpp detail/varint.cpp ; + +local RUN_TESTS ; for local f in $(SOURCES) { RUN_TESTS += [ run $(f) $(TEST_MAIN) ] ; } +alias run-tests : $(RUN_TESTS) ; + +unit-test run-fat : $(TEST_MAIN) $(SOURCES) ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(SOURCES) ; +explicit build-fat ; diff --git a/test/http/Jamfile b/test/http/Jamfile index 1cbb0a5a..ada45275 100644 --- a/test/http/Jamfile +++ b/test/http/Jamfile @@ -7,8 +7,7 @@ # Official repository: https://github.com/boostorg/beast # -unit-test http-tests : - ../../extras/boost/beast/unit_test/main.cpp +local SOURCES = basic_dynamic_body.cpp basic_file_body.cpp basic_parser.cpp @@ -34,3 +33,12 @@ unit-test http-tests : verb.cpp write.cpp ; + +local RUN_TESTS ; for local f in $(SOURCES) { RUN_TESTS += [ run $(f) $(TEST_MAIN) ] ; } +alias run-tests : $(RUN_TESTS) ; + +unit-test run-fat : $(TEST_MAIN) $(SOURCES) ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(SOURCES) ; +explicit build-fat ; diff --git a/test/server/Jamfile b/test/server/Jamfile index 9e62cb18..0a5af922 100644 --- a/test/server/Jamfile +++ b/test/server/Jamfile @@ -7,8 +7,7 @@ # Official repository: https://github.com/boostorg/beast # -unit-test server-test : - ../../extras/boost/beast/unit_test/main.cpp +local SOURCES = file_service.cpp framework.cpp http_async_port.cpp @@ -24,7 +23,13 @@ unit-test server-test : ws_sync_port.cpp ws_upgrade_service.cpp wss_ports.cpp - : - coverage:no - ubasan:no ; + +local RUN_TESTS ; for local f in $(SOURCES) { RUN_TESTS += [ run $(f) $(TEST_MAIN) ] ; } +alias run-tests : $(RUN_TESTS) ; + +unit-test run-fat : $(TEST_MAIN) $(SOURCES) tests.cpp : : : coverage:no ubasan:no ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(SOURCES) tests.cpp : : : coverage:no ubasan:no ; +explicit build-fat ; diff --git a/test/websocket/Jamfile b/test/websocket/Jamfile index f28dcedb..b5e08ba9 100644 --- a/test/websocket/Jamfile +++ b/test/websocket/Jamfile @@ -7,8 +7,7 @@ # Official repository: https://github.com/boostorg/beast # -unit-test websocket-tests : - ../../extras/boost/beast/unit_test/main.cpp +local SOURCES = doc_snippets.cpp error.cpp option.cpp @@ -19,3 +18,12 @@ unit-test websocket-tests : mask.cpp utf8_checker.cpp ; + +local RUN_TESTS ; for local f in $(SOURCES) { RUN_TESTS += [ run $(f) $(TEST_MAIN) ] ; } +alias run-tests : $(RUN_TESTS) ; + +unit-test run-fat : $(TEST_MAIN) $(SOURCES) ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(SOURCES) ; +explicit build-fat ; diff --git a/test/wstest/Jamfile b/test/wstest/Jamfile index 7219d19d..26f48e79 100644 --- a/test/wstest/Jamfile +++ b/test/wstest/Jamfile @@ -7,6 +7,9 @@ # Official repository: https://github.com/boostorg/beast # -exe wstest : +alias wstest : main.cpp ; +explicit wstest ; + +alias run-tests : [ compile main.cpp ] : : : coverage:no ubasan:no ; diff --git a/test/zlib/Jamfile b/test/zlib/Jamfile index 614a46df..bf4819e8 100644 --- a/test/zlib/Jamfile +++ b/test/zlib/Jamfile @@ -7,8 +7,7 @@ # Official repository: https://github.com/boostorg/beast # -unit-test zlib-tests : - ../../extras/boost/beast/unit_test/main.cpp +local ZLIB_SOURCES = zlib-1.2.11/adler32.c zlib-1.2.11/compress.c zlib-1.2.11/crc32.c @@ -20,7 +19,19 @@ unit-test zlib-tests : zlib-1.2.11/trees.c zlib-1.2.11/uncompr.c zlib-1.2.11/zutil.c + ; + +local SOURCES = deflate_stream.cpp error.cpp inflate_stream.cpp ; + +local RUN_TESTS ; for local f in $(SOURCES) { RUN_TESTS += [ run $(f) $(TEST_MAIN) $(ZLIB_SOURCES) ] ; } +alias run-tests : $(RUN_TESTS) ; + +unit-test run-fat : $(TEST_MAIN) $(ZLIB_SOURCES) $(SOURCES) ; +explicit run-fat ; + +exe build-fat : $(TEST_MAIN) $(ZLIB_SOURCES) $(SOURCES) ; +explicit build-fat ;