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