Skip to content

Commit

Permalink
Move tests of extensions inside test/ directory (#302)
Browse files Browse the repository at this point in the history
Split header tests accordingly i.e. test core headers as part of
core tests, numeric extension headers as part of numeric tests, etc.

It extends the convention of sub-directories already established in
`include/boost/gil` directory. It is sensible to follow it in other
areas of the source tree (i.e. `test/`, `doc/` and `benchmark/`).

Another important reason to move the tests is to enable removal of
the top-level `Jamfile` with all its definitions of test-specific
requirements.
The top-level `Jamfile` is not advised, especially if it specifies
build requirements like C++ language version.
Those affect non-tests builds e.g. documentation, causing failures
during generation of HTML documentation (leads to missing docs).
  • Loading branch information
mloskot committed May 28, 2019
1 parent 446a35b commit 4ed7701
Show file tree
Hide file tree
Showing 209 changed files with 273 additions and 261 deletions.
8 changes: 4 additions & 4 deletions .appveyor.yml
Expand Up @@ -118,10 +118,10 @@ before_build:
build: off

build_script:
- if NOT DEFINED GENERATOR b2 address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% libs/gil/test
- if NOT DEFINED GENERATOR b2 address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% libs/gil/toolbox/test
- if NOT DEFINED GENERATOR b2 address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% libs/gil/numeric/test
- if NOT DEFINED GENERATOR b2 address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% include=%VCPKG_I% library-path=%VCPKG_L% libs/gil/io/test//simple
- if NOT DEFINED GENERATOR b2 --abbreviate-paths address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% libs/gil/test/core
- if NOT DEFINED GENERATOR b2 --abbreviate-paths address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% libs/gil/test/extension/numeric
- if NOT DEFINED GENERATOR b2 --abbreviate-paths address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% libs/gil/test/extension/toolbox
- if NOT DEFINED GENERATOR b2 --abbreviate-paths address-model=%AM% toolset=%TOOLSET% variant=%VARIANT% cxxstd=%CXXSTD% include=%VCPKG_I% library-path=%VCPKG_L% libs/gil/test/extension/io//simple
- if DEFINED GENERATOR cd libs\gil && md build && cd build
- if DEFINED GENERATOR cmake -G "%GENERATOR%" -DCMAKE_CXX_STANDARD=%CXXSTD% -DBoost_DETAILED_FAILURE_MSG=ON -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake ..
- if DEFINED GENERATOR cmake --build . --config %CMAKE_CONFIG %
Expand Down
8 changes: 4 additions & 4 deletions .ci/build-and-test.sh
Expand Up @@ -38,7 +38,7 @@ fi
echo "Running ./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT"

set -euv
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/test
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/toolbox/test
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/numeric/test
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/io/test//simple
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/test/core
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/test/extension/numeric
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/test/extension/toolbox
./b2 -j $JOBS $B2_OPTIONS toolset=$TOOLSET variant=$VARIANT cxxstd=$CXXSTD libs/gil/test/extension/io//simple
12 changes: 6 additions & 6 deletions .circleci/config.yml
Expand Up @@ -281,25 +281,25 @@ steps_test_core: &steps_test_core
steps:
- *attach_workspace
- *run_compiler_version
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/test
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/test/core

steps_test_toolbox: &steps_test_toolbox
steps_test_numeric: &steps_test_numeric
steps:
- *attach_workspace
- *run_compiler_version
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/toolbox/test
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/test/extension/numeric

steps_test_numeric: &steps_test_numeric
steps_test_toolbox: &steps_test_toolbox
steps:
- *attach_workspace
- *run_compiler_version
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/numeric/test
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/test/extension/toolbox

steps_test_io: &steps_test_io
steps:
- *attach_workspace
- *run_compiler_version
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/io/test//simple
- run: cd boost-root && ./b2 toolset=$TOOLSET $VARIANT $OPTIMIZ cxxstd="$CXXSTD" libs/gil/test/extension/io//simple

##############################################################################
# Build jobs
Expand Down
17 changes: 3 additions & 14 deletions CMakeLists.txt
Expand Up @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.10)
# Options
#-----------------------------------------------------------------------------
option(GIL_BUILD_EXAMPLES "Build examples" ON)
option(GIL_BUILD_HEADERS_TESTS "Enable self-contained header tests" ON)
option(GIL_BUILD_HEADER_TESTS "Enable self-contained header tests" ON)
option(GIL_ENABLE_EXT_IO "Enable IO extension, tests and examples (require libjpeg, libpng, libtiff)" ON)
option(GIL_ENABLE_EXT_NUMERIC "Enable Numeric extension, tests and examples" ON)
option(GIL_ENABLE_EXT_TOOLBOX "Enable Toolbox extension, tests and examples" ON)
Expand Down Expand Up @@ -266,21 +266,10 @@ enable_testing()
# On Boost regression builds, CMake does not run, but Boost.Build,
# so the header tests are not enabled there either.
if(DEFINED ENV{CI})
set(GIL_BUILD_HEADERS_TESTS OFF)
endif()
add_subdirectory(test)

if(GIL_ENABLE_EXT_IO)
add_subdirectory(io/test)
set(GIL_BUILD_HEADER_TESTS OFF)
endif()

if(GIL_ENABLE_EXT_NUMERIC)
add_subdirectory(numeric/test)
endif()

if(GIL_ENABLE_EXT_TOOLBOX)
add_subdirectory(toolbox/test)
endif()
add_subdirectory(test)

#-----------------------------------------------------------------------------
# Examples
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Expand Up @@ -343,21 +343,21 @@ Run core tests only specifying location of directory with tests:

```shell
cd libs/gil
../../b2 -j8 test
../../b2 -j8 test/core
```

Run all tests for selected extension (from Boost root directory, as alternative):

```shell
./b2 -j8 libs/gil/io/test
./b2 -j8 libs/gil/numeric/test
./b2 -j8 libs/gil/toolbox/test
./b2 -j8 libs/gil/test/io
./b2 -j8 libs/gil/test/numeric
./b2 -j8 libs/gil/test/toolbox
```

Run I/O extension tests bundled in target called `simple`:

```shell
./b2 libs/gil/io/test//simple
./b2 libs/gil/test/io//simple
```

*TODO:* _Explain I/O dependencies (libjpeg, etc.)_
Expand Down
81 changes: 0 additions & 81 deletions Jamfile

This file was deleted.

2 changes: 1 addition & 1 deletion doc/io.rst
Expand Up @@ -267,7 +267,7 @@ The following code sample shows the usage::
, tag_t
> reader_t;

reader_t reader = make_scanline_reader( "C:/boost/libs/gil/io/test_images/tiff/test.tif", tag_t() );
reader_t reader = make_scanline_reader( "C:/boost/libs/gil/test/extension/io/images/tiff/test.tif", tag_t() );

typedef rgba8_image_t image_t;

Expand Down
8 changes: 4 additions & 4 deletions example/cmake/CMakeSettings.json
Expand Up @@ -27,7 +27,7 @@
{ "name": "GIL_ENABLE_EXT_NUMERIC", "value": "ON" },
{ "name": "GIL_ENABLE_EXT_TOOLBOX", "value": "ON" },
{ "name": "GIL_BUILD_EXAMPLES", "value": "ON" },
{ "name": "GIL_BUILD_HEADERS_TESTS", "value": "OFF" },
{ "name": "GIL_BUILD_HEADER_TESTS", "value": "OFF" },
{ "name": "GIL_DOWNLOAD_FINDBOOST", "value": "ON" },
{ "name": "GIL_USE_CONAN", "value": "ON" }
]
Expand All @@ -51,7 +51,7 @@
{ "name": "GIL_ENABLE_EXT_NUMERIC", "value": "ON" },
{ "name": "GIL_ENABLE_EXT_TOOLBOX", "value": "ON" },
{ "name": "GIL_BUILD_EXAMPLES", "value": "OFF" },
{ "name": "GIL_BUILD_HEADERS_TESTS", "value": "OFF" },
{ "name": "GIL_BUILD_HEADER_TESTS", "value": "OFF" },
{ "name": "GIL_DOWNLOAD_FINDBOOST", "value": "ON" },
{ "name": "GIL_USE_CONAN", "value": "OFF" }
]
Expand All @@ -75,7 +75,7 @@
{ "name": "GIL_ENABLE_EXT_NUMERIC", "value": "ON" },
{ "name": "GIL_ENABLE_EXT_TOOLBOX", "value": "ON" },
{ "name": "GIL_BUILD_EXAMPLES", "value": "ON" },
{ "name": "GIL_BUILD_HEADERS_TESTS", "value": "ON" },
{ "name": "GIL_BUILD_HEADER_TESTS", "value": "ON" },
{ "name": "GIL_DOWNLOAD_FINDBOOST", "value": "ON" },
{ "name": "GIL_USE_CONAN", "value": "ON" }
]
Expand All @@ -99,7 +99,7 @@
{ "name": "GIL_ENABLE_EXT_NUMERIC", "value": "ON" },
{ "name": "GIL_ENABLE_EXT_TOOLBOX", "value": "ON" },
{ "name": "GIL_BUILD_EXAMPLES", "value": "ON" },
{ "name": "GIL_BUILD_HEADERS_TESTS", "value": "ON" },
{ "name": "GIL_BUILD_HEADER_TESTS", "value": "ON" },
{ "name": "GIL_DOWNLOAD_FINDBOOST", "value": "ON" },
{ "name": "GIL_USE_CONAN", "value": "ON" }
]
Expand Down
16 changes: 0 additions & 16 deletions io/index.html

This file was deleted.

42 changes: 8 additions & 34 deletions test/CMakeLists.txt
@@ -1,44 +1,18 @@
#
# Copyright (c) 2017-2019 Mateusz Loskot <mateusz at loskot dot net>
# Copyright (c) 2019 Mateusz Loskot <mateusz at loskot dot net>
#
# 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)
#
message(STATUS "Boost.GIL: Configuring core tests")
add_subdirectory(core)

foreach(_name
promote_integral)
set(_test t_utility_${_name})
set(_target test_utility_${_name})

add_executable(${_target} "")
target_sources(${_target} PRIVATE ${_name}.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(NAME ${_test} COMMAND ${_target})
add_subdirectory(legacy)

unset(_name)
unset(_target)
unset(_test)
endforeach()
add_subdirectory(extension)

if(GIL_BUILD_HEADERS_TESTS)
add_subdirectory(headers)
endif()
# TODO: Split headers tests into core and extensions, see Jamfile-s
# if(GIL_BUILD_HEADERS_TESTS)
# add_subdirectory(headers)
# endif()

add_subdirectory(point)
add_subdirectory(channel)
add_subdirectory(color)
add_subdirectory(color_base)
add_subdirectory(pixel)
add_subdirectory(iterator)
add_subdirectory(locator)
add_subdirectory(image)
add_subdirectory(image_view)
add_subdirectory(algorithm)
add_subdirectory(legacy)

0 comments on commit 4ed7701

Please sign in to comment.