fabscript 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. from faber import platform
  10. from faber.feature import set
  11. from faber.tools.compiler import define, libs, linkpath
  12. from faber.artefacts.binary import binary
  13. from faber.test import test, report, fail
  14. from os.path import join
  15. boost_suffix = options.get_with('boost-suffix')
  16. boost_suffix = '-' + boost_suffix if boost_suffix else ''
  17. boost_unit_test_framework = 'boost_unit_test_framework' + boost_suffix
  18. boost_filesystem = 'boost_filesystem' + boost_suffix
  19. boost_system = 'boost_system' + boost_suffix
  20. test_features = set(define('BOOST_TEST_DYN_LINK'),
  21. libs(boost_unit_test_framework,
  22. boost_system,
  23. boost_filesystem))
  24. without_jpeg = options.get_without('jpeg')
  25. jpeg_features = test_features + set(libs('jpeg'))
  26. jpeg_prefix = options.get_with('jpeg-prefix')
  27. if jpeg_prefix:
  28. jpeg_features += include(join(jpeg_prefix, 'include'))
  29. jpeg_features += linkpath(join(jpeg_prefix, 'lib64'), join(jpeg_prefix, 'lib'))
  30. without_png = options.get_without('png')
  31. png = options.get_with('png') or 'png' # on some platforms the library uses another name
  32. png_features = test_features + set(libs(png))
  33. png_prefix = options.get_with('png-prefix')
  34. if png_prefix:
  35. png_features += include(join(png_prefix, 'include'))
  36. png_features += linkpath(join(png_prefix, 'lib64'), join(png_prefix, 'lib'))
  37. without_tiff = options.get_without('tiff')
  38. tiff_features = test_features + set(libs('tiff'))
  39. tiff_prefix = options.get_with('tiff-prefix')
  40. if tiff_prefix:
  41. tiff_features += include(join(tiff_prefix, 'include'))
  42. tiff_features += linkpath(join(tiff_prefix, 'lib64'), join(tiff_prefix, 'lib'))
  43. def gil_test(name, sources, features, condition=True):
  44. return test(name, binary(name, sources, features=features, condition=condition))
  45. tests = [gil_test('all_formats_test', ['all_formats_test.cpp'], features=test_features | png_features | jpeg_features),
  46. gil_test('bmp',
  47. ['bmp_test.cpp', 'bmp_old_test.cpp', 'bmp_read_test.cpp', 'bmp_write_test.cpp'],
  48. features=test_features),
  49. gil_test('jpeg', ['jpeg_test.cpp', 'jpeg_old_test.cpp', 'jpeg_read_test.cpp', 'jpeg_write_test.cpp'],
  50. features=jpeg_features,
  51. condition=not without_jpeg),
  52. gil_test('png', ['png_test.cpp', 'png_old_test.cpp', 'png_file_format_test.cpp', 'png_read_test.cpp'],
  53. features=png_features,
  54. condition=not without_png),
  55. gil_test('pnm', ['pnm_test.cpp', 'pnm_old_test.cpp', 'pnm_read_test.cpp', 'pnm_write_test.cpp'],
  56. features=test_features),
  57. gil_test('targa', ['targa_test.cpp', 'targa_old_test.cpp', 'targa_read_test.cpp', 'targa_write_test.cpp'],
  58. features=test_features),
  59. gil_test('tiff', ['tiff_test.cpp',
  60. 'tiff_old_test.cpp',
  61. 'tiff_file_format_test.cpp',
  62. 'tiff_tiled_float_test.cpp',
  63. 'tiff_tiled_minisblack_test_1-10.cpp',
  64. 'tiff_tiled_minisblack_test_11-20.cpp',
  65. 'tiff_tiled_minisblack_test_21-31_32-64.cpp',
  66. 'tiff_tiled_minisblack_write_test_1-10.cpp',
  67. 'tiff_tiled_minisblack_write_test_11-20.cpp',
  68. 'tiff_tiled_minisblack_write_test_21-31_32-64.cpp',
  69. 'tiff_tiled_palette_test_1-8.cpp',
  70. 'tiff_tiled_palette_test_8-16.cpp',
  71. 'tiff_tiled_palette_write_test_1-8.cpp',
  72. 'tiff_tiled_palette_write_test_8-16.cpp',
  73. 'tiff_tiled_rgb_contig_test_1-10.cpp',
  74. 'tiff_tiled_rgb_contig_test_11-20.cpp',
  75. 'tiff_tiled_rgb_contig_test_21-31_32_64.cpp',
  76. 'tiff_tiled_rgb_contig_write_test_1-10.cpp',
  77. 'tiff_tiled_rgb_contig_write_test_11-20.cpp',
  78. 'tiff_tiled_rgb_contig_write_test_21-31_32_64.cpp',
  79. 'tiff_tiled_rgb_planar_test_1-10.cpp',
  80. 'tiff_tiled_rgb_planar_test_11-20.cpp',
  81. 'tiff_tiled_rgb_planar_test_21-31_32_64.cpp',
  82. 'tiff_tiled_test.cpp',
  83. 'tiff_write_test.cpp'],
  84. features=tiff_features,
  85. condition=not without_tiff)
  86. ]
  87. default = report('report', tests, fail_on_failures=True)