• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Boost.GIL (Generic Image Library) - tests
2#
3# Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4# Copyright (c) 2018-2019 Mateusz Loskot <mateusz@loskot.net>
5# Copyright (c) 2018 Dmitry Arkhipov
6# Copyright (c) 2007-2015 Andrey Semashev
7#
8# Use, modification and distribution is subject to the Boost Software License,
9# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10# http://www.boost.org/LICENSE_1_0.txt)
11
12import ../../config/checks/config : requires ;
13import os ;
14import path ;
15import regex ;
16import sequence ;
17import testing ;
18
19# Avoid warnings flood on Travis CI, AppVeyor, CircleCI, Azure Pipelines, GitHub Actions
20if ! [ os.environ CI ] && ! [ os.environ AGENT_JOBSTATUS ] && ! [ os.environ GITHUB_ACTIONS ]
21{
22  DEVELOPMENT_EXTRA_WARNINGS =
23    <toolset>msvc:<cxxflags>"-W4"
24    <toolset>gcc:<cxxflags>"-pedantic -Wextra -Wcast-align -Wconversion -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter"
25    <toolset>clang,<variant>debug:<cxxflags>"-pedantic -Wextra -Wcast-align -Wconversion -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter -Wsign-conversion"
26    <toolset>clang,<variant>release:<cxxflags>"-pedantic -Wextra -Wcast-align -Wconversion -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter -Wsign-conversion"
27    <toolset>darwin:<cxxflags>"-pedantic -Wextra -Wcast-align -Wconversion -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter"
28    ;
29}
30else
31{
32  DEVELOPMENT_EXTRA_WARNINGS =
33    <toolset>msvc:<cxxflags>"-W1"
34    ;
35}
36
37project
38  :
39  requirements
40    <include>.
41    # TODO: Enable concepts check for all, not just test/core
42    #<define>BOOST_GIL_USE_CONCEPT_CHECK=1
43    <toolset>msvc:<cxxflags>"-bigobj"
44    <toolset>msvc:<asynch-exceptions>on
45    <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
46    <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
47    <toolset>msvc:<define>_CRT_NONSTDC_NO_DEPRECATE
48    <toolset>msvc:<define>NOMINMAX
49    <toolset>intel:<debug-symbols>off
50    <toolset>gcc:<cxxflags>"-fstrict-aliasing"
51    <toolset>darwin:<cxxflags>"-fstrict-aliasing"
52    # variant filter for clang is necessary to allow ubsan_*
53    # custom variants declare distinct set of <cxxflags>
54    <toolset>clang,<variant>debug:<cxxflags>"-fstrict-aliasing"
55    <toolset>clang,<variant>release:<cxxflags>"-fstrict-aliasing"
56    $(DEVELOPMENT_EXTRA_WARNINGS)
57    [ requires
58        cxx11_constexpr
59        cxx11_defaulted_functions
60        cxx11_template_aliases
61        cxx11_trailing_result_types  # implies decltype and auto
62        cxx11_variadic_templates
63    ]
64  ;
65
66variant gil_ubsan_integer
67    : release
68    :
69    <cxxflags>"-Wno-unused -fstrict-aliasing -fno-omit-frame-pointer -fsanitize=integer -fno-sanitize-recover=integer -fsanitize-blacklist=libs/gil/.ci/blacklist.supp"
70    <linkflags>"-fsanitize=integer"
71    <debug-symbols>on
72    <define>BOOST_USE_ASAN=1
73    ;
74
75variant gil_ubsan_nullability
76    : release
77    :
78    <cxxflags>"-Wno-unused -fstrict-aliasing -fno-omit-frame-pointer -fsanitize=nullability -fno-sanitize-recover=nullability -fsanitize-blacklist=libs/gil/.ci/blacklist.supp"
79    <linkflags>"-fsanitize=nullability"
80    <debug-symbols>on
81    <define>BOOST_USE_ASAN=1
82    ;
83
84variant gil_ubsan_undefined
85    : release
86    :
87    <cxxflags>"-Wno-unused -fstrict-aliasing -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-blacklist=libs/gil/.ci/blacklist.supp"
88    <linkflags>"-fsanitize=undefined"
89    <debug-symbols>on
90    <define>BOOST_USE_ASAN=1
91    ;
92
93rule generate_self_contained_headers ( headers_subpath * : exclude_subpaths * )
94{
95    # On CI services, test the self-contained headers on-demand only to avoid build timeouts
96    # CI environment is common for Travis CI, AppVeyor, CircleCI, etc.
97    # For example:
98    # if ! [ os.environ CI ] || [ os.environ TEST_HEADERS ] {
99    #    alias self_contained_headers : [ generate_self_contained_headers ] ;
100    # }
101
102    local targets ;
103
104    # NOTE: All '/' in test names are replaced with '-' because apparently
105    #       test scripts have a problem with test names containing slashes.
106
107    local top_headers_path = [ path.make $(BOOST_ROOT)/libs/gil/include/boost/gil ] ;
108    local headers_path = $(top_headers_path) ;
109    if $(headers_subpath)
110    {
111        headers_path = $(top_headers_path)/$(headers_subpath) ;
112    }
113
114    for local file in [ path.glob-tree $(headers_path) : *.hpp : $(exclude_subpaths) ]
115    {
116        local target_no = [ sequence.length $(targets) ] ;
117        local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ;
118        local target_name = [ regex.replace h/$(target_no)/$(rel_file) "/" "-" ] ;
119        local target_name = [ regex.replace $(target_name) "\.hpp" "" ] ;
120        targets += [
121            compile $(BOOST_ROOT)/libs/gil/test/header/main.cpp
122            : <define>"BOOST_GIL_TEST_HEADER=$(rel_file)" <dependency>$(file)
123            : $(target_name)
124        ] ;
125    }
126
127    return $(targets) ;
128}
129
130run test_utility_output_stream.cpp ;
131
132build-project core ;
133build-project legacy ;
134build-project extension ;
135