File: meson.build

package info (click to toggle)
harfbuzz 12.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 100,084 kB
  • sloc: ansic: 77,785; cpp: 61,949; python: 4,961; xml: 4,651; sh: 426; makefile: 105
file content (124 lines) | stat: -rw-r--r-- 3,207 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
tests = [
  'hb-shape-fuzzer.cc',
  'hb-subset-fuzzer.cc',
  'hb-set-fuzzer.cc',
  'hb-draw-fuzzer.cc',
  'hb-repacker-fuzzer.cc',
]

# Build the binaries
foreach file_name : tests
  test_name = file_name.split('.')[0]

  sources = [file_name]
  fuzzer_ldflags = []
  extra_cpp_args = []

  if get_option('fuzzer_ldflags') == ''
    sources += 'main.cc'
  else
    fuzzer_ldflags += get_option('fuzzer_ldflags').split()
    extra_cpp_args += '-DHB_IS_IN_FUZZER'
  endif

  if get_option('experimental_api')
    extra_cpp_args += '-DHB_EXPERIMENTAL_API'
  endif

  exe = executable(test_name, sources,
    cpp_args: cpp_args + extra_cpp_args,
    include_directories: [incconfig, incsrc],
    link_args: fuzzer_ldflags,
    link_with: [libharfbuzz, libharfbuzz_subset],
    install: false,
  )
  set_variable('@0@_exe'.format(test_name.underscorify()), exe)
endforeach

glob_cmd = find_program('glob.py', required: true)

fonts_glob = run_command(glob_cmd, meson.current_source_dir() / 'fonts', check:true).stdout().strip().split('\n')
subset_fonts_glob = run_command(glob_cmd, meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', check:true).stdout().strip().split('\n')
graphs_glob = run_command(glob_cmd, meson.current_source_dir() / 'graphs', check:true).stdout().strip().split('\n')
sets_glob = run_command(glob_cmd, meson.current_source_dir() / 'sets', check:true).stdout().strip().split('\n')

# Chunk the glob lists to avoid command line length limits, and for parallelization
chunk_size = 64
foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'graphs_glob', 'sets_glob']
  glob = get_variable(glob_name)
  chunks = []
  chunk = []
  foreach item : glob
    if chunk.length() >= chunk_size
      chunks += [chunk]
      chunk = []
    endif
    chunk += [item]
  endforeach
  if chunk.length() > 0
    chunks += [chunk]
  endif
  set_variable('@0@_chunks'.format(glob_name), chunks)
endforeach

# Run fuzzers

i = 0
foreach chunk : fonts_glob_chunks
  test('shape-fuzzer-chunk-@0@'.format(i),
    hb_shape_fuzzer_exe,
    args: chunk,
    workdir: meson.current_build_dir() / '..' / '..',
    protocol: 'tap',
    suite: ['fuzzing'],
  )
  i += 1
endforeach

i = 0
foreach chunk : fonts_glob_chunks
  test('draw-fuzzer-chunk-@0@'.format(i),
    hb_draw_fuzzer_exe,
    args: chunk,
    workdir: meson.current_build_dir() / '..' / '..',
    protocol: 'tap',
    suite: ['fuzzing'],
  )
  i += 1
endforeach

i = 0
foreach chunk : fonts_glob_chunks + subset_fonts_glob_chunks
  test('subset-fuzzer-chunk-@0@'.format(i),
    hb_subset_fuzzer_exe,
    args: chunk,
    workdir: meson.current_build_dir() / '..' / '..',
    protocol: 'tap',
    suite: ['fuzzing'],
  )
  i += 1
endforeach

i = 0
foreach chunk : graphs_glob_chunks
  test('repacker-fuzzer-chunk-@0@'.format(i),
    hb_repacker_fuzzer_exe,
    args: chunk,
    workdir: meson.current_build_dir() / '..' / '..',
    protocol: 'tap',
    suite: ['fuzzing'],
  )
  i += 1
endforeach

i = 0
foreach chunk : sets_glob_chunks
  test('set-fuzzer-chunk-@0@'.format(i),
    hb_set_fuzzer_exe,
    args: chunk,
    workdir: meson.current_build_dir() / '..' / '..',
    protocol: 'tap',
    suite: ['fuzzing'],
  )
  i += 1
endforeach