mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 05:51:05 +01:00
* [meson] Skip vector tests when vector is disabled The vector budget test was built unconditionally even when vector was explicitly disabled. Its empty dependency supplied neither include paths nor libraries, breaking otherwise valid reduced-feature builds. Skip the vector test directory when the library is disabled. Add a Linux CI build and test pass with vector disabled to cover this configuration. Reproduced the missing hb.h failure on Linux before the fix. The full suite with vector, raster, and GPU disabled passed 229 tests with one skip; all three vector tests passed with vector enabled. Fixes: https://github.com/harfbuzz/harfbuzz/issues/6277 Assisted-by: OpenAI Codex <codex@openai.com> * [ci] Remove extra vector-disabled build pass Keep the fix focused on guarding the vector test directory without adding another build and test pass to the Linux workflow. CI-only change; the previously validated Meson guard is unchanged. Assisted-by: OpenAI Codex <codex@openai.com> * [meson] Guard dependency fuzzers when subset is disabled With experimental APIs enabled, dependency fuzzers referenced libharfbuzz_subset even when the subset library was disabled, causing Meson setup to fail with an unknown-variable error. Require subset support when building the dependency fuzzers and when registering their tests. Full tests with experimental APIs enabled: 92 passed with subset disabled, and 247 passed with subset enabled. Both dependency fuzzers and their 13 tests remain registered in the enabled configuration. Assisted-by: OpenAI Codex <codex@openai.com>
282 lines
7.4 KiB
Meson
282 lines
7.4 KiB
Meson
tests = [
|
|
'hb-shape-fuzzer.cc',
|
|
'hb-subset-fuzzer.cc',
|
|
'hb-raster-fuzzer.cc',
|
|
'hb-vector-fuzzer.cc',
|
|
'hb-gpu-fuzzer.cc',
|
|
'hb-repacker-fuzzer.cc',
|
|
]
|
|
|
|
depend_tests = [
|
|
'hb-depend-closure-parity.cc',
|
|
'hb-depend-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
|
|
|
|
if (test_name.contains('subset') or test_name.contains('repacker')) and get_option('subset').disabled()
|
|
continue
|
|
endif
|
|
|
|
if test_name.contains('raster') and get_option('raster').disabled()
|
|
continue
|
|
endif
|
|
|
|
if test_name.contains('vector') and get_option('vector').disabled()
|
|
continue
|
|
endif
|
|
|
|
if test_name.contains('gpu') and get_option('gpu').disabled()
|
|
continue
|
|
endif
|
|
|
|
link_with_libs = [libharfbuzz]
|
|
if test_name.contains('subset') or test_name.contains('repacker')
|
|
link_with_libs += [libharfbuzz_subset]
|
|
endif
|
|
if test_name.contains('raster')
|
|
link_with_libs += [libharfbuzz_raster]
|
|
endif
|
|
if test_name.contains('vector')
|
|
link_with_libs += [libharfbuzz_vector]
|
|
endif
|
|
if test_name.contains('gpu')
|
|
link_with_libs += [libharfbuzz_gpu]
|
|
endif
|
|
|
|
|
|
exe = executable(test_name, sources,
|
|
cpp_args: cpp_args + extra_cpp_args,
|
|
include_directories: [incconfig, incsrc],
|
|
dependencies: [],
|
|
link_args: fuzzer_ldflags,
|
|
link_with: link_with_libs,
|
|
install: false,
|
|
)
|
|
set_variable('@0@_exe'.format(test_name.underscorify()), exe)
|
|
endforeach
|
|
|
|
# Build depend-related fuzzers only if experimental and subset APIs are enabled
|
|
if conf.get('HB_EXPERIMENTAL_API', 0) == 1 and not get_option('subset').disabled()
|
|
foreach file_name : depend_tests
|
|
test_name = file_name.split('.')[0]
|
|
|
|
sources = [file_name]
|
|
fuzzer_ldflags = []
|
|
extra_cpp_args = []
|
|
|
|
if get_option('fuzzer_ldflags') == ''
|
|
# hb-depend-closure-parity has custom main that sets font path global
|
|
if test_name == 'hb-depend-closure-parity'
|
|
sources += 'hb-depend-closure-parity-main.cc'
|
|
else
|
|
sources += 'main.cc'
|
|
endif
|
|
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
|
|
|
|
# hb-depend-closure-parity needs glib for option parsing
|
|
test_deps = []
|
|
if test_name == 'hb-depend-closure-parity'
|
|
if conf.get('HAVE_GLIB', 0) == 0
|
|
continue
|
|
endif
|
|
test_deps = [glib_dep]
|
|
endif
|
|
|
|
exe = executable(test_name, sources,
|
|
cpp_args: cpp_args + extra_cpp_args,
|
|
include_directories: [incconfig, incsrc],
|
|
dependencies: test_deps,
|
|
link_args: fuzzer_ldflags,
|
|
link_with: [libharfbuzz, libharfbuzz_subset],
|
|
install: false,
|
|
)
|
|
set_variable('@0@_exe'.format(test_name.underscorify()), exe)
|
|
endforeach
|
|
endif
|
|
|
|
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')
|
|
|
|
depend_closure_parity_fonts_glob = []
|
|
depend_closure_parity_noto_nastaliq_fonts = []
|
|
foreach font : subset_fonts_glob
|
|
if font.contains('NotoNastaliqUrdu-Bold.ttf') or font.contains('NotoNastaliqUrdu-Regular.ttf')
|
|
depend_closure_parity_noto_nastaliq_fonts += [font]
|
|
else
|
|
depend_closure_parity_fonts_glob += [font]
|
|
endif
|
|
endforeach
|
|
|
|
# Chunk the glob lists to avoid command line length limits, and for parallelization
|
|
chunk_size = 64
|
|
foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'depend_closure_parity_fonts_glob', 'graphs_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
|
|
|
|
if not get_option('raster').disabled()
|
|
i = 0
|
|
foreach chunk : fonts_glob_chunks
|
|
test('raster-fuzzer-chunk-@0@'.format(i),
|
|
hb_raster_fuzzer_exe,
|
|
args: chunk,
|
|
workdir: meson.current_build_dir() / '..' / '..',
|
|
protocol: 'tap',
|
|
suite: ['fuzzing'],
|
|
)
|
|
i += 1
|
|
endforeach
|
|
endif
|
|
|
|
if not get_option('vector').disabled()
|
|
i = 0
|
|
foreach chunk : fonts_glob_chunks
|
|
test('vector-fuzzer-chunk-@0@'.format(i),
|
|
hb_vector_fuzzer_exe,
|
|
args: chunk,
|
|
workdir: meson.current_build_dir() / '..' / '..',
|
|
protocol: 'tap',
|
|
suite: ['fuzzing'],
|
|
)
|
|
i += 1
|
|
endforeach
|
|
endif
|
|
|
|
if not get_option('gpu').disabled()
|
|
i = 0
|
|
foreach chunk : fonts_glob_chunks
|
|
test('gpu-fuzzer-chunk-@0@'.format(i),
|
|
hb_gpu_fuzzer_exe,
|
|
args: chunk,
|
|
workdir: meson.current_build_dir() / '..' / '..',
|
|
protocol: 'tap',
|
|
suite: ['fuzzing'],
|
|
)
|
|
i += 1
|
|
endforeach
|
|
endif
|
|
|
|
if not get_option('subset').disabled()
|
|
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
|
|
endif
|
|
|
|
if not get_option('subset').disabled()
|
|
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
|
|
endif
|
|
|
|
if conf.get('HB_EXPERIMENTAL_API', 0) == 1 and not get_option('subset').disabled()
|
|
if conf.get('HAVE_GLIB', 0) == 1
|
|
i = 0
|
|
foreach chunk : depend_closure_parity_fonts_glob_chunks
|
|
test('depend-closure-parity-chunk-@0@'.format(i),
|
|
hb_depend_closure_parity_exe,
|
|
args: ['-s', '42', '-n', '16'] + chunk,
|
|
workdir: meson.current_build_dir() / '..' / '..',
|
|
protocol: 'tap',
|
|
suite: ['fuzzing'],
|
|
)
|
|
i += 1
|
|
endforeach
|
|
|
|
foreach font : depend_closure_parity_noto_nastaliq_fonts
|
|
font_name = 'regular'
|
|
if font.contains('NotoNastaliqUrdu-Bold.ttf')
|
|
font_name = 'bold'
|
|
endif
|
|
test('depend-closure-parity-noto-nastaliq-@0@'.format(font_name),
|
|
hb_depend_closure_parity_exe,
|
|
args: ['-s', '42', '-n', '16', font],
|
|
workdir: meson.current_build_dir() / '..' / '..',
|
|
protocol: 'tap',
|
|
suite: ['fuzzing'],
|
|
)
|
|
endforeach
|
|
endif
|
|
|
|
i = 0
|
|
foreach chunk : fonts_glob_chunks
|
|
test('depend-fuzzer-chunk-@0@'.format(i),
|
|
hb_depend_fuzzer_exe,
|
|
args: chunk,
|
|
workdir: meson.current_build_dir() / '..' / '..',
|
|
protocol: 'tap',
|
|
suite: ['fuzzing'],
|
|
)
|
|
i += 1
|
|
endforeach
|
|
endif
|