From af77b6af07069c023729520104cbf79e642fe3cb Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Sun, 12 May 2019 13:33:54 +0200 Subject: [PATCH] Decouple tests and benchmarks, turn off warnings for tests with some external boost libs - Tests and benchmarks now only include the headers they really need. - Warnings turned off for tests that compile with external boost libs that are not warning free --- .gitignore | 1 + Jamfile | 1 - benchmark/histogram_filling.cpp | 4 +++- benchmark/histogram_iteration.cpp | 9 +++++++-- benchmark/histogram_parallel_filling.cpp | 5 ++++- include/boost/histogram/algorithm/reduce.hpp | 1 - test/CMakeLists.txt | 4 ++++ test/Jamfile | 21 ++++++++++++-------- test/algorithm_sum_test.cpp | 20 +++++++++---------- test/deduction_guides_test.cpp | 6 +++++- test/histogram_growing_test.cpp | 4 +++- test/histogram_serialization_test.cpp | 19 +++++++++--------- test/histogram_threaded_test.cpp | 5 ++++- 13 files changed, 63 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 72fc82b4..52a70614 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ */_deps */fetch_and_include */benchmark +compile_commands.json CMakeFiles CMakeCache.txt Makefile diff --git a/Jamfile b/Jamfile index a1e1ea54..5b583bd0 100644 --- a/Jamfile +++ b/Jamfile @@ -30,7 +30,6 @@ project gcc:"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing" : default-build all - #on ; build-project test ; diff --git a/benchmark/histogram_filling.cpp b/benchmark/histogram_filling.cpp index a88355ed..4e11d059 100644 --- a/benchmark/histogram_filling.cpp +++ b/benchmark/histogram_filling.cpp @@ -5,7 +5,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include +#include +#include #include #include "../test/utility_histogram.hpp" diff --git a/benchmark/histogram_iteration.cpp b/benchmark/histogram_iteration.cpp index b7594693..f2703801 100644 --- a/benchmark/histogram_iteration.cpp +++ b/benchmark/histogram_iteration.cpp @@ -5,8 +5,13 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include using namespace boost::histogram; diff --git a/benchmark/histogram_parallel_filling.cpp b/benchmark/histogram_parallel_filling.cpp index f190e76c..8f8efe5d 100644 --- a/benchmark/histogram_parallel_filling.cpp +++ b/benchmark/histogram_parallel_filling.cpp @@ -5,7 +5,10 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include +#include +#include +#include #include #include #include diff --git a/include/boost/histogram/algorithm/reduce.hpp b/include/boost/histogram/algorithm/reduce.hpp index ed9dc974..aa04f745 100644 --- a/include/boost/histogram/algorithm/reduce.hpp +++ b/include/boost/histogram/algorithm/reduce.hpp @@ -21,7 +21,6 @@ #include #include #include -#include namespace boost { namespace histogram { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d51a3e07..7a8bc615 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,6 +37,8 @@ boost_test(TYPE run SOURCES detail_linearize_test.cpp LIBRARIES Boost::histogram Boost::core) boost_test(TYPE run SOURCES detail_iterator_adaptor_test.cpp LIBRARIES Boost::histogram Boost::core) +boost_test(TYPE run SOURCES detail_variant_test.cpp + LIBRARIES Boost::histogram Boost::core) boost_test(TYPE run SOURCES histogram_dynamic_test.cpp LIBRARIES Boost::histogram Boost::core) boost_test(TYPE run SOURCES histogram_growing_test.cpp @@ -81,3 +83,5 @@ endif() # boost_test(TYPE run SOURCES unlimited_storage_serialization_test.cpp LIBRARIES Boost::histogram Boost::core Boost::serialization) # boost_test(TYPE run SOURCES storage_adaptor_serialization_test.cpp LIBRARIES Boost::histogram Boost::core Boost::serialization) # boost_test(TYPE run SOURCES histogram_serialization_test.cpp LIBRARIES Boost::histogram Boost::core Boost::serialization) +# boost_test(TYPE run SOURCES detail_variant_serialization_test.cpp +# LIBRARIES Boost::histogram Boost::core Boost::serialization) diff --git a/test/Jamfile b/test/Jamfile index b94065c5..78e2b701 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -67,7 +67,7 @@ alias cxx17 : [ run deduction_guides_test.cpp ] : [ requires cpp_deduction_guides ] ; - + # check that useful error messages are produced when library is used incorrectly alias failure : [ compile-fail make_histogram_fail0.cpp ] @@ -76,24 +76,29 @@ alias failure : alias threading : [ run histogram_threaded_test.cpp ] - [ run storage_adaptor_threaded_test.cpp ] : + [ run storage_adaptor_threaded_test.cpp ] + : multi ; -alias accumulators : [ run boost_accumulators_support_test.cpp ] ; -alias range : [ run boost_range_support_test.cpp ] ; -alias units : [ run boost_units_support_test.cpp ] ; - +# warnings are off for these other boost libraries, which tend to be not warning-free +alias accumulators : [ run boost_accumulators_support_test.cpp ] : off ; +alias range : [ run boost_range_support_test.cpp ] : off ; +alias units : [ run boost_units_support_test.cpp ] : off ; alias serialization : [ run storage_adaptor_serialization_test.cpp libserial ] [ run histogram_serialization_test.cpp libserial ] [ run unlimited_storage_serialization_test.cpp libserial ] [ run detail_variant_serialization_test.cpp libserial ] + : + off ; alias libserial : - /boost/serialization//boost_serialization : - static ; + /boost/serialization//boost_serialization + : + static off + ; # "failure" not included in "all", because it is distracting alias all : cxx14 cxx17 threading accumulators range units serialization ; diff --git a/test/algorithm_sum_test.cpp b/test/algorithm_sum_test.cpp index 0d8b16f0..16a2dd62 100644 --- a/test/algorithm_sum_test.cpp +++ b/test/algorithm_sum_test.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -15,7 +14,6 @@ #include "utility_histogram.hpp" using namespace boost::histogram; -using namespace boost::histogram::literals; // to get _c suffix using boost::histogram::algorithm::sum; template @@ -39,16 +37,16 @@ void run_tests() { for (unsigned i = 0; i < 100; ++i) h4(i); BOOST_TEST_EQ(sum(h4), 100); - // auto h5 = - // make_s(Tag(), std::vector>(), axis::integer<>(0, 1), - // axis::integer(2, 4)); - // h5(weight(2), 0, 2); - // h5(-1, 2); - // h5(1, 3); + auto h5 = + make_s(Tag(), std::vector>(), axis::integer<>(0, 1), + axis::integer(2, 4)); + h5(weight(2), 0, 2); + h5(-1, 2); + h5(1, 3); - // const auto v = algorithm::sum(h5); - // BOOST_TEST_EQ(v.value(), 4); - // BOOST_TEST_EQ(v.variance(), 6); + const auto v = algorithm::sum(h5); + BOOST_TEST_EQ(v.value(), 4); + BOOST_TEST_EQ(v.variance(), 6); } int main() { diff --git a/test/deduction_guides_test.cpp b/test/deduction_guides_test.cpp index 8f9406d7..df0b9d66 100644 --- a/test/deduction_guides_test.cpp +++ b/test/deduction_guides_test.cpp @@ -6,9 +6,13 @@ #include #include -#include +#include +#include #include +#include #include +#include +#include #include #include #include diff --git a/test/histogram_growing_test.cpp b/test/histogram_growing_test.cpp index 4c30345e..cee36b58 100644 --- a/test/histogram_growing_test.cpp +++ b/test/histogram_growing_test.cpp @@ -5,7 +5,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include +#include +#include #include #include #include "utility_histogram.hpp" diff --git a/test/histogram_serialization_test.cpp b/test/histogram_serialization_test.cpp index aeea93e2..0de6bd15 100644 --- a/test/histogram_serialization_test.cpp +++ b/test/histogram_serialization_test.cpp @@ -5,7 +5,7 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include #include #include #include "utility_histogram.hpp" @@ -19,14 +19,15 @@ void run_tests(const char* filename) { namespace tr = axis::transform; using def = use_default; using axis::option::none_t; - auto a = make(Tag(), axis::regular(1, -1, 1, "reg"), - axis::circular(1, 0.0, 1.0, "cir"), - axis::regular(1, 1, std::exp(2), "reg-log"), - axis::regular, axis::option::overflow_t>( - tr::pow(0.5), 1, 1, 100, {1, 2, 3}), - axis::variable({1.5, 2.5}, "var"), - axis::category{3, 1}, - axis::integer(1, 2)); + auto a = + make(Tag(), axis::regular(1, -1, 1, "reg"), + axis::circular(1, 0.0, 1.0, "cir"), + axis::regular(1, 1, std::exp(2), "reg-log"), + axis::regular, axis::option::overflow_t>( + tr::pow(0.5), 1, 1, 100, {1, 2, 3}), + axis::variable({1.5, 2.5}, "var"), + axis::category{3, 1}, + axis::integer(1, 2)); a(0.5, 0.2, 2, 20, 2.2, 1, 1); print_xml(filename, a); diff --git a/test/histogram_threaded_test.cpp b/test/histogram_threaded_test.cpp index 22913aad..ac2a58a1 100644 --- a/test/histogram_threaded_test.cpp +++ b/test/histogram_threaded_test.cpp @@ -5,7 +5,10 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include +#include +#include +#include #include #include #include