• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- python -*-
2#
3# Copyright (c) 2017 Stefan Seefeld
4# All rights reserved.
5#
6# Distributed under the Boost Software License, Version 1.0.
7# (See accompanying file LICENSE_1_0.txt or copy at
8# http://www.boost.org/LICENSE_1_0.txt)
9
10from faber import platform
11from faber.feature import set
12from faber.tools.compiler import define, libs, linkpath
13from faber.artefacts.binary import binary
14from faber.test import test, report, fail
15from os.path import join
16
17boost_suffix = options.get_with('boost-suffix')
18boost_suffix = '-' + boost_suffix if boost_suffix else ''
19boost_unit_test_framework = 'boost_unit_test_framework' + boost_suffix
20boost_filesystem = 'boost_filesystem' + boost_suffix
21boost_system = 'boost_system' + boost_suffix
22
23test_features = set(define('BOOST_TEST_DYN_LINK'),
24                    libs(boost_unit_test_framework,
25                         boost_system,
26                         boost_filesystem))
27
28without_jpeg = options.get_without('jpeg')
29jpeg_features = test_features + set(libs('jpeg'))
30jpeg_prefix = options.get_with('jpeg-prefix')
31if jpeg_prefix:
32    jpeg_features += include(join(jpeg_prefix, 'include'))
33    jpeg_features += linkpath(join(jpeg_prefix, 'lib64'), join(jpeg_prefix, 'lib'))
34
35without_png = options.get_without('png')
36png = options.get_with('png') or 'png'  # on some platforms the library uses another name
37png_features = test_features + set(libs(png))
38png_prefix = options.get_with('png-prefix')
39if png_prefix:
40    png_features += include(join(png_prefix, 'include'))
41    png_features += linkpath(join(png_prefix, 'lib64'), join(png_prefix, 'lib'))
42
43without_tiff = options.get_without('tiff')
44tiff_features = test_features + set(libs('tiff'))
45tiff_prefix = options.get_with('tiff-prefix')
46if tiff_prefix:
47    tiff_features += include(join(tiff_prefix, 'include'))
48    tiff_features += linkpath(join(tiff_prefix, 'lib64'), join(tiff_prefix, 'lib'))
49
50
51def gil_test(name, sources, features, condition=True):
52    return test(name, binary(name, sources, features=features, condition=condition))
53
54
55tests = [gil_test('all_formats_test', ['all_formats_test.cpp'], features=test_features | png_features | jpeg_features),
56         gil_test('bmp',
57                  ['bmp_test.cpp', 'bmp_old_test.cpp', 'bmp_read_test.cpp', 'bmp_write_test.cpp'],
58                  features=test_features),
59         gil_test('jpeg', ['jpeg_test.cpp', 'jpeg_old_test.cpp', 'jpeg_read_test.cpp', 'jpeg_write_test.cpp'],
60                  features=jpeg_features,
61                  condition=not without_jpeg),
62         gil_test('png', ['png_test.cpp', 'png_old_test.cpp', 'png_file_format_test.cpp', 'png_read_test.cpp'],
63                  features=png_features,
64                  condition=not without_png),
65         gil_test('pnm', ['pnm_test.cpp', 'pnm_old_test.cpp', 'pnm_read_test.cpp', 'pnm_write_test.cpp'],
66                  features=test_features),
67         gil_test('targa', ['targa_test.cpp', 'targa_old_test.cpp', 'targa_read_test.cpp', 'targa_write_test.cpp'],
68                  features=test_features),
69         gil_test('tiff', ['tiff_test.cpp',
70                           'tiff_old_test.cpp',
71                           'tiff_file_format_test.cpp',
72                           'tiff_tiled_float_test.cpp',
73                           'tiff_tiled_minisblack_test_1-10.cpp',
74                           'tiff_tiled_minisblack_test_11-20.cpp',
75                           'tiff_tiled_minisblack_test_21-31_32-64.cpp',
76                           'tiff_tiled_minisblack_write_test_1-10.cpp',
77                           'tiff_tiled_minisblack_write_test_11-20.cpp',
78                           'tiff_tiled_minisblack_write_test_21-31_32-64.cpp',
79                           'tiff_tiled_palette_test_1-8.cpp',
80                           'tiff_tiled_palette_test_8-16.cpp',
81                           'tiff_tiled_palette_write_test_1-8.cpp',
82                           'tiff_tiled_palette_write_test_8-16.cpp',
83                           'tiff_tiled_rgb_contig_test_1-10.cpp',
84                           'tiff_tiled_rgb_contig_test_11-20.cpp',
85                           'tiff_tiled_rgb_contig_test_21-31_32_64.cpp',
86                           'tiff_tiled_rgb_contig_write_test_1-10.cpp',
87                           'tiff_tiled_rgb_contig_write_test_11-20.cpp',
88                           'tiff_tiled_rgb_contig_write_test_21-31_32_64.cpp',
89                           'tiff_tiled_rgb_planar_test_1-10.cpp',
90                           'tiff_tiled_rgb_planar_test_11-20.cpp',
91                           'tiff_tiled_rgb_planar_test_21-31_32_64.cpp',
92                           'tiff_tiled_test.cpp',
93                           'tiff_write_test.cpp'],
94                  features=tiff_features,
95                  condition=not without_tiff)
96]
97
98default = report('report', tests, fail_on_failures=True)
99