mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-23 22:14:18 +02:00
Add fuzzing script
This commit is contained in:
parent
e130498ecd
commit
4f38f0f1e1
4 changed files with 36 additions and 0 deletions
16
README.md
16
README.md
|
|
@ -278,6 +278,22 @@ if meson is already available or
|
|||
|
||||
otherwise.
|
||||
|
||||
#### Scripts
|
||||
|
||||
Cagebreak provides a few convenience tools to facilitate development.
|
||||
|
||||
##### Fuzzing
|
||||
|
||||
If your fuzzing corpus is located in the directory `fuzz_corpus` you can
|
||||
just call:
|
||||
|
||||
```
|
||||
meson compile fuzz -C build
|
||||
```
|
||||
|
||||
If you want to use a different directory, configure cagebreak with
|
||||
`-Dcorpus=OTHERDIRECTORY` or call `./scripts/fuzz OTHERDIRECTORY`.
|
||||
|
||||
### GCC and -fanalyzer
|
||||
|
||||
Cagebreak should compile with any reasonably new gcc or clang. Consider
|
||||
|
|
|
|||
|
|
@ -347,6 +347,9 @@ message('\n'.join(summary))
|
|||
run_target('devel-install',
|
||||
command : ['scripts/install-development-environment'])
|
||||
|
||||
run_target('fuzz',
|
||||
command : ['scripts/fuzz', get_option('corpus')])
|
||||
|
||||
# Test Suite
|
||||
|
||||
test('Build without warnings', find_program('test/build-w-o-warnings'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@ option('xwayland', type: 'boolean', value: 'false', description: 'Enable support
|
|||
option('man-pages', type: 'boolean', value: 'false', description: 'Build man pages (requires pandoc)')
|
||||
option('fuzz', type: 'boolean', value: 'false', description: 'Enable building fuzzer targets')
|
||||
option('version_override', type: 'string', description: 'Set the project version to the string specified. Used for creating hashes for reproducible builds.')
|
||||
option('corpus', type: 'string', value: 'fuzz_corpus', description: 'Set fuzzing corpus directory')
|
||||
|
|
|
|||
16
scripts/fuzz
Executable file
16
scripts/fuzz
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
readonly fuzzing_corpus="${1}"
|
||||
|
||||
if [[ -n ${MESON_SOURCE_ROOT} ]]
|
||||
then
|
||||
# shellcheck disable=2164
|
||||
cd "${MESON_SOURCE_ROOT}"
|
||||
fi
|
||||
|
||||
rm -rf fuzzing-directory
|
||||
CC=clang meson setup fuzzing-directory -Dfuzz=true -Db_sanitize=address,undefined -Db_lundef=false -Db_detect-leaks=0
|
||||
ninja -C fuzzing-directory/
|
||||
WLR_BACKENDS=headless ./fuzzing-directory/fuzz-parse -jobs=12 -max_len=50000 -close_fd_mask=3 "${fuzzing_corpus}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue