[meson] Use a glob.py instead of ls / dir

This commit is contained in:
Behdad Esfahbod 2025-04-06 12:46:43 -06:00
parent 155e1e633b
commit 2b5ae9dec3
3 changed files with 19 additions and 18 deletions

View file

@ -149,9 +149,8 @@ jobs:
executor: win64-executor
steps:
- checkout
- run: dpkg --add-architecture i386
- run: apt update
- run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 wine32:i386
- run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64
- run: |
export LANG=en_US.UTF-8
python3 -m venv venv

16
test/fuzzing/glob.py Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env python3
import sys
import os
if len(sys.argv) < 2:
print("Usage: python glob.py [DIR]...")
sys.exit(1)
for arg in sys.argv[1:]:
if os.path.isdir(arg):
for dirpath, dirnames, filenames in os.walk(arg):
for filename in filenames:
print(os.path.join(dirpath, filename))
elif os.path.isfile(arg):
print(arg)

View file

@ -66,27 +66,13 @@ test('draw-fuzzer', run_fuzzer_tests,
suite: ['fuzzing'],
)
ls = find_program('ls')
if not ls.found()
# On Windows, we need to use the 'dir' command to list files in a directory.
# The 'ls' command is not available by default.
find = [find_program('dir', required: true), '/b', '/a-d']
else
# On other platforms, we can use the 'ls' command.
find = [find_program('ls', required: true)]
endif
glob_cmd = find_program('glob.py', required: true)
# Subset fuzzer: feed the fuzzer directly, without run-fuzzer-tests.py
font_dirs = [
meson.current_source_dir() / 'fonts',
meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts',
]
glob = []
foreach font_dir : font_dirs
dir = run_command(find, font_dir, check:true).stdout().strip().split('\n')
foreach item : dir
glob += [font_dir / item]
endforeach
endforeach
glob = run_command(glob_cmd, font_dirs, check:true).stdout().strip().split('\n')
# Chunk glob and call runner for each chunk
chunk_size = 64