meson.build 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. tests = [
  2. 'hb-shape-fuzzer.cc',
  3. 'hb-subset-fuzzer.cc',
  4. 'hb-set-fuzzer.cc',
  5. 'hb-draw-fuzzer.cc',
  6. ]
  7. if get_option('experimental_api')
  8. tests += 'hb-repacker-fuzzer.cc'
  9. endif
  10. foreach file_name : tests
  11. test_name = file_name.split('.')[0]
  12. sources = [file_name]
  13. fuzzer_ldflags = []
  14. extra_cpp_args = []
  15. if get_option('fuzzer_ldflags') == ''
  16. sources += 'main.cc'
  17. else
  18. fuzzer_ldflags += get_option('fuzzer_ldflags').split()
  19. extra_cpp_args += '-DHB_IS_IN_FUZZER'
  20. endif
  21. if get_option('experimental_api')
  22. extra_cpp_args += '-DHB_EXPERIMENTAL_API'
  23. endif
  24. exe = executable(test_name, sources,
  25. cpp_args: cpp_args + extra_cpp_args,
  26. include_directories: [incconfig, incsrc],
  27. link_args: fuzzer_ldflags,
  28. link_with: [libharfbuzz, libharfbuzz_subset],
  29. install: false,
  30. )
  31. set_variable('@0@_exe'.format(test_name.underscorify()), exe)
  32. endforeach
  33. env = environment()
  34. env.set('srcdir', meson.current_source_dir())
  35. test('shape_fuzzer', find_program('run-shape-fuzzer-tests.py'),
  36. args: [
  37. hb_shape_fuzzer_exe,
  38. ],
  39. timeout: 300,
  40. depends: [hb_shape_fuzzer_exe, libharfbuzz, libharfbuzz_subset],
  41. workdir: meson.current_build_dir() / '..' / '..',
  42. env: env,
  43. suite: ['fuzzing', 'slow'],
  44. )
  45. test('subset_fuzzer', find_program('run-subset-fuzzer-tests.py'),
  46. args: [
  47. hb_subset_fuzzer_exe,
  48. ],
  49. # as the tests are ran concurrently let's raise acceptable time here
  50. # ideally better to break and let meson handles them in parallel
  51. timeout: 300,
  52. workdir: meson.current_build_dir() / '..' / '..',
  53. env: env,
  54. suite: ['fuzzing', 'slow'],
  55. )
  56. if get_option('experimental_api')
  57. test('repacker_fuzzer', find_program('run-repacker-fuzzer-tests.py'),
  58. args: [
  59. hb_repacker_fuzzer_exe,
  60. ],
  61. # as the tests are ran concurrently let's raise acceptable time here
  62. # ideally better to break and let meson handles them in parallel
  63. timeout: 300,
  64. workdir: meson.current_build_dir() / '..' / '..',
  65. env: env,
  66. suite: ['fuzzing', 'slow'],
  67. )
  68. endif
  69. test('draw_fuzzer', find_program('run-draw-fuzzer-tests.py'),
  70. args: [
  71. hb_draw_fuzzer_exe,
  72. ],
  73. workdir: meson.current_build_dir() / '..' / '..',
  74. env: env,
  75. suite: ['fuzzing'],
  76. )