harfbuzz/TESTING.md

86 lines
2.1 KiB
Markdown
Raw Normal View History

## Build & Run
Depending on what area you are working in change or add `HB_DEBUG_<whatever>`.
Values defined in `hb-debug.hh`.
```shell
# quick sanity check
2019-05-10 03:06:29 +00:00
time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
2019-05-10 23:52:43 +00:00
&& (make -j4 -C test/api check || cat test/api/test-suite.log))
2019-05-10 03:06:29 +00:00
# slower sanity check
time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
&& make -j4 -C src check \
&& make -j4 -C test/api check \
&& make -j4 -C test/subset check)
# confirm you didn't break anything else
2019-05-10 03:06:29 +00:00
time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
&& make -j4 check)
# often catches files you didn't add, e.g. test fonts to EXTRA_DIST
make distcheck
```
2019-05-10 23:52:43 +00:00
### Run tests with asan
2019-05-21 03:45:11 +00:00
**NOTE**: this sometimes yields harder to read results than the full fuzzer
2019-05-10 23:52:43 +00:00
```shell
2019-05-16 22:58:49 +00:00
# For nice symbols tell asan how to symoblize. Note that it doesn't like versioned copies like llvm-symbolizer-3.8
# export ASAN_SYMBOLIZER_PATH=path to version-less llvm-symbolizer
# ex
export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-3.8/bin/llvm-symbolizer
2019-05-10 23:52:43 +00:00
./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address
# make/run tests as usual
```
### Debug with GDB
```
cd ./util
../libtool --mode=execute gdb --args ./hb-subset ...
```
### Enable Debug Logging
```shell
# make clean if you previously build w/o debug logging
make CPPFLAGS=-DHB_DEBUG_SUBSET=100
```
## Build and Test via CMake
Note: You'll need to first install ninja-build via apt-get.
```shell
2020-03-13 11:10:07 +00:00
meson build && ninja -Cbuild && ninja -Cbuild test
```
2020-03-13 11:10:07 +00:00
## Test with the Fuzzer
```shell
# push your changs to a branch on googlefonts/harfbuzz
# In a local copy of oss-fuzz, edit projects/harfbuzz/Dockerfile
# Change the git clone to pull your branch
2019-05-21 03:45:11 +00:00
# Do this periodically
sudo python infra/helper.py build_image harfbuzz
2019-05-21 03:45:11 +00:00
# Do these to update/run
sudo python infra/helper.py build_fuzzers --sanitizer address harfbuzz
sudo python infra/helper.py run_fuzzer harfbuzz hb-subset-fuzzer
```
## Profiling
```
make clean
./configure CXXFLAGS="-fno-omit-frame-pointer -g"
make
perf record -o <perf output file> -g <command to run>
perf report -i<perf output file>
```