diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62a11fd7a..6cdc1bca6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,6 +63,8 @@ please follow the workflow explained in this document. * **DO** assume that the [Squash and Merge] will be used to merge your commit unless you request otherwise in the PR. * **DO** NOT fix merge conflicts using a merge commit. Prefer git rebase. +* **DO** NOT submit changes to the original legacy tests, see + [test/legacy/README.md](test/legacy/README.md). ### Merging Pull Requests (for maintainers with write access) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8d3711697..340c3a60d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2017 Mateusz Loskot +# Copyright (c) 2017-2019 Mateusz Loskot # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at @@ -7,18 +7,12 @@ # message(STATUS "Boost.GIL: Configuring core tests") -# All-in-one tests, legacy -# TODO: To be refactored to modular foreach(_name - channel - image - pixel - pixel_iterator promote_integral) set(_target all_in_one_${_name}) add_executable(${_target} "") - target_sources(${_target} PRIVATE ${_name}.cpp error_if.cpp) + target_sources(${_target} PRIVATE ${_name}.cpp) target_link_libraries(${_target} PRIVATE gil_compile_options @@ -31,23 +25,14 @@ foreach(_name unset(_name) endforeach() -# Add extra source files accompanying image.cpp -target_sources(all_in_one_image - PRIVATE - error_if.cpp - sample_image.cpp) -add_test(test.all_in_one.image - all_in_one_image - ${CMAKE_CURRENT_SOURCE_DIR}/gil_reference_checksums.txt) - if(GIL_BUILD_HEADERS_TESTS) add_subdirectory(headers) endif() -# Modular tests add_subdirectory(point) add_subdirectory(channel) add_subdirectory(pixel) add_subdirectory(image) add_subdirectory(image_view) add_subdirectory(algorithm) +add_subdirectory(legacy) diff --git a/test/Jamfile b/test/Jamfile index 981dc7104..c3c96c6d5 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -2,37 +2,27 @@ # # Copyright (c) 2007-2015 Andrey Semashev # Copyright (c) 2008 Lubomir Bourdev, Hailin Jin -# Copyright (c) 2018 Mateusz Loskot +# Copyright (c) 2018-2019 Mateusz Loskot # Copyright (c) 2018 Dmitry Arkhipov # # 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) -import os ; -import path ; -import regex ; import testing ; project : requirements - $(BOOST_ROOT) . BOOST_GIL_USE_CONCEPT_CHECK ; -run promote_integral.cpp /boost/test//boost_unit_test_framework : : : shared:BOOST_TEST_DYN_LINK=1 ; -run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt ; -run channel.cpp error_if.cpp ; -run pixel.cpp error_if.cpp ; -run pixel_iterator.cpp error_if.cpp ; - build-project algorithm ; build-project channel ; build-project image ; build-project image_view ; build-project pixel ; build-project point ; +build-project legacy ; -alias perf : [ run performance.cpp ] ; -explicit perf ; +run promote_integral.cpp /boost/test//boost_unit_test_framework : : : shared:BOOST_TEST_DYN_LINK=1 ; diff --git a/test/algorithm/Jamfile b/test/algorithm/Jamfile index 0155db584..067506b0d 100644 --- a/test/algorithm/Jamfile +++ b/test/algorithm/Jamfile @@ -1,6 +1,6 @@ # Boost.GIL (Generic Image Library) - tests # -# Copyright (c) 2018 Mateusz Loskot +# Copyright (c) 2018-2019 Mateusz Loskot # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or @@ -8,11 +8,5 @@ import testing ; -project - : requirements - $(BOOST_ROOT) - .. - ; - run for_each_pixel.cpp ; run std_fill.cpp ; diff --git a/test/channel/Jamfile b/test/channel/Jamfile index 5794e8f65..61382b766 100644 --- a/test/channel/Jamfile +++ b/test/channel/Jamfile @@ -10,7 +10,6 @@ import testing ; project : requirements - $(BOOST_ROOT) .. /boost/test//boost_unit_test_framework shared:BOOST_TEST_DYN_LINK=1 diff --git a/test/channel/algorithm_channel_arithmetic.cpp b/test/channel/algorithm_channel_arithmetic.cpp index e569096d8..f0f399279 100644 --- a/test/channel/algorithm_channel_arithmetic.cpp +++ b/test/channel/algorithm_channel_arithmetic.cpp @@ -11,7 +11,7 @@ #include #define BOOST_TEST_MODULE test_algorithm_channel_arithmetic -#include +#include "unit_test.hpp" #include "channel_test_fixture.hpp" namespace gil = boost::gil; diff --git a/test/channel/algorithm_channel_convert.cpp b/test/channel/algorithm_channel_convert.cpp index d9ad2b571..2437b8c1a 100644 --- a/test/channel/algorithm_channel_convert.cpp +++ b/test/channel/algorithm_channel_convert.cpp @@ -10,7 +10,7 @@ #include #define BOOST_TEST_MODULE test_algorithm_channel_convert -#include +#include "unit_test.hpp" #include "channel_test_fixture.hpp" namespace gil = boost::gil; diff --git a/test/channel/algorithm_channel_invert.cpp b/test/channel/algorithm_channel_invert.cpp index ab279151d..bc0c73796 100644 --- a/test/channel/algorithm_channel_invert.cpp +++ b/test/channel/algorithm_channel_invert.cpp @@ -9,7 +9,7 @@ #include #define BOOST_TEST_MODULE test_algorithm_channel_invert -#include +#include "unit_test.hpp" #include "channel_test_fixture.hpp" namespace gil = boost::gil; diff --git a/test/channel/algorithm_channel_multiply.cpp b/test/channel/algorithm_channel_multiply.cpp index c7521bf20..7f2e6484a 100644 --- a/test/channel/algorithm_channel_multiply.cpp +++ b/test/channel/algorithm_channel_multiply.cpp @@ -9,7 +9,7 @@ #include #define BOOST_TEST_MODULE test_algorithm_channel_multiply -#include +#include "unit_test.hpp" #include "channel_test_fixture.hpp" namespace gil = boost::gil; diff --git a/test/channel/algorithm_channel_relation.cpp b/test/channel/algorithm_channel_relation.cpp index 258ffce99..d1e7b4c49 100644 --- a/test/channel/algorithm_channel_relation.cpp +++ b/test/channel/algorithm_channel_relation.cpp @@ -9,7 +9,7 @@ #include #define BOOST_TEST_MODULE test_algorithm_channel_relation -#include +#include "unit_test.hpp" #include "channel_test_fixture.hpp" namespace gil = boost::gil; diff --git a/test/channel/channel_concepts.cpp b/test/channel/channel_concepts.cpp index 3ad1151e3..262cbe716 100644 --- a/test/channel/channel_concepts.cpp +++ b/test/channel/channel_concepts.cpp @@ -22,7 +22,7 @@ #include #define BOOST_TEST_MODULE test_channel_concepts -#include +#include "unit_test.hpp" #include "channel_test_fixture.hpp" namespace gil = boost::gil; diff --git a/test/channel/channel_test_fixture.cpp b/test/channel/channel_test_fixture.cpp index 7e6faecdf..e0b45e1d6 100644 --- a/test/channel/channel_test_fixture.cpp +++ b/test/channel/channel_test_fixture.cpp @@ -5,11 +5,12 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // -#define BOOST_TEST_MODULE test_channel_test_fixture -#include -#include "channel_test_fixture.hpp" #include +#define BOOST_TEST_MODULE test_channel_test_fixture +#include "unit_test.hpp" +#include "channel_test_fixture.hpp" + namespace fixture = boost::gil::test::fixture; BOOST_AUTO_TEST_CASE_TEMPLATE(channel_minmax_value_integral, Channel, fixture::channel_integer_types) diff --git a/test/channel/channel_traits.cpp b/test/channel/channel_traits.cpp index 7f0dd3f5b..f8fccdfd4 100644 --- a/test/channel/channel_traits.cpp +++ b/test/channel/channel_traits.cpp @@ -11,7 +11,7 @@ #include #define BOOST_TEST_MODULE test_channel_traits -#include +#include "unit_test.hpp" namespace gil = boost::gil; diff --git a/test/channel/scoped_channel_value.cpp b/test/channel/scoped_channel_value.cpp index ce6832e50..6e221ad5c 100644 --- a/test/channel/scoped_channel_value.cpp +++ b/test/channel/scoped_channel_value.cpp @@ -13,7 +13,7 @@ #include #define BOOST_TEST_MODULE test_scoped_channel_value -#include +#include "unit_test.hpp" namespace gil = boost::gil; diff --git a/test/image/Jamfile b/test/image/Jamfile index 9ed002776..0634ad6a3 100644 --- a/test/image/Jamfile +++ b/test/image/Jamfile @@ -10,7 +10,6 @@ import testing ; project : requirements - $(BOOST_ROOT) .. ; diff --git a/test/image_view/Jamfile b/test/image_view/Jamfile index fad67b4b5..5145a2639 100644 --- a/test/image_view/Jamfile +++ b/test/image_view/Jamfile @@ -10,7 +10,6 @@ import testing ; project : requirements - $(BOOST_ROOT) .. ; diff --git a/test/legacy/CMakeLists.txt b/test/legacy/CMakeLists.txt new file mode 100644 index 000000000..875e8173d --- /dev/null +++ b/test/legacy/CMakeLists.txt @@ -0,0 +1,46 @@ +# +# Copyright (c) 2019 Mateusz Loskot +# +# 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) +# +# *** IMPORTANT MAINTENANCE RULES *** +# These are GIL's original, comprehensive, all-in-one test suites. +# * Keep as reference. +# * Do NOT extend. +# * Do NOT refactor. +# * Modify only if absolutely necessary (a bug found in the tests). +# See the accompanying README.md +# +message(STATUS "Boost.GIL: Configuring core tests") + +foreach(_name + channel + image + pixel + pixel_iterator) + set(_target legacy_${_name}) + + add_executable(${_target} "") + target_sources(${_target} PRIVATE ${_name}.cpp error_if.cpp) + target_link_libraries(${_target} + PRIVATE + gil_compile_options + gil_include_directories + gil_dependencies) + target_compile_definitions(${_target} PRIVATE BOOST_GIL_USE_CONCEPT_CHECK) + add_test(test.legacy.${_name} ${_target}) + + unset(_target) + unset(_name) +endforeach() + +# Add extra source files accompanying image.cpp +target_sources(legacy_image + PRIVATE + error_if.cpp + sample_image.cpp) +add_test(test.legacy.image + legacy_image + ${CMAKE_CURRENT_SOURCE_DIR}/gil_reference_checksums.txt) diff --git a/test/legacy/Jamfile b/test/legacy/Jamfile new file mode 100644 index 000000000..048ab8c49 --- /dev/null +++ b/test/legacy/Jamfile @@ -0,0 +1,26 @@ +# Boost.GIL (Generic Image Library) - legacy tests +# +# Copyright (c) 2007-2015 Andrey Semashev +# Copyright (c) 2008 Lubomir Bourdev, Hailin Jin +# +# 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) +# +# *** IMPORTANT MAINTENANCE RULES *** +# These are GIL's original, comprehensive, all-in-one test suites. +# * Keep as reference. +# * Do NOT extend. +# * Do NOT refactor. +# * Modify only if absolutely necessary (a bug found in the tests). +# See the accompanying README.md + +import testing ; + +run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt ; +run channel.cpp error_if.cpp ; +run pixel.cpp error_if.cpp ; +run pixel_iterator.cpp error_if.cpp ; + +alias perf : [ run performance.cpp ] ; +explicit perf ; diff --git a/test/legacy/README.md b/test/legacy/README.md new file mode 100644 index 000000000..76bc42828 --- /dev/null +++ b/test/legacy/README.md @@ -0,0 +1,16 @@ +# Boost.GIL Legacy Tests + +These are GIL's original, comprehensive, all-in-one test suits. + +Rules of maintenance: + +* Run the legacy tests as part of CI builds and regression tests. +* Keep as reference. +* Do NOT extend. +* Do NOT refactor. +* Modify ONLY if absolutely necessary (a bug found in the tests). + +Add new test suites, with new test cases, even if their +functional coverage is the same as of the legacy tests. + +See [CONTRIBUTING.md](../../CONTRIBUTING.md). diff --git a/test/channel.cpp b/test/legacy/channel.cpp similarity index 100% rename from test/channel.cpp rename to test/legacy/channel.cpp diff --git a/test/error_if.cpp b/test/legacy/error_if.cpp similarity index 100% rename from test/error_if.cpp rename to test/legacy/error_if.cpp diff --git a/test/gil_reference_checksums.txt b/test/legacy/gil_reference_checksums.txt similarity index 100% rename from test/gil_reference_checksums.txt rename to test/legacy/gil_reference_checksums.txt diff --git a/test/image.cpp b/test/legacy/image.cpp similarity index 100% rename from test/image.cpp rename to test/legacy/image.cpp diff --git a/test/performance.cpp b/test/legacy/performance.cpp similarity index 100% rename from test/performance.cpp rename to test/legacy/performance.cpp diff --git a/test/pixel.cpp b/test/legacy/pixel.cpp similarity index 100% rename from test/pixel.cpp rename to test/legacy/pixel.cpp diff --git a/test/pixel_iterator.cpp b/test/legacy/pixel_iterator.cpp similarity index 100% rename from test/pixel_iterator.cpp rename to test/legacy/pixel_iterator.cpp diff --git a/test/recreate_image.cpp b/test/legacy/recreate_image.cpp similarity index 100% rename from test/recreate_image.cpp rename to test/legacy/recreate_image.cpp diff --git a/test/sample_image.cpp b/test/legacy/sample_image.cpp similarity index 100% rename from test/sample_image.cpp rename to test/legacy/sample_image.cpp diff --git a/test/pixel/Jamfile b/test/pixel/Jamfile index 9ed002776..0634ad6a3 100644 --- a/test/pixel/Jamfile +++ b/test/pixel/Jamfile @@ -10,7 +10,6 @@ import testing ; project : requirements - $(BOOST_ROOT) .. ; diff --git a/test/point/Jamfile b/test/point/Jamfile index a940ae34e..94effaf1f 100644 --- a/test/point/Jamfile +++ b/test/point/Jamfile @@ -10,7 +10,6 @@ import testing ; project : requirements - $(BOOST_ROOT) .. ; diff --git a/test/promote_integral.cpp b/test/promote_integral.cpp index 1e97f623a..43610db5a 100644 --- a/test/promote_integral.cpp +++ b/test/promote_integral.cpp @@ -18,8 +18,6 @@ // #include -#include - #include #include #include @@ -31,7 +29,7 @@ #ifndef BOOST_TEST_MODULE #define BOOST_TEST_MODULE test_promote_integral #endif -#include +#include "unit_test.hpp" // Uncomment to enable debugging output //#define BOOST_GIL_TEST_DEBUG 1 diff --git a/test/gil_test_common.hpp b/test/unit_test.hpp similarity index 100% rename from test/gil_test_common.hpp rename to test/unit_test.hpp