• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Build & Run
2
3Depending on what area you are working in change or add `HB_DEBUG_<whatever>`.
4Values defined in `hb-debug.hh`.
5
6```shell
7# quick sanity check
8time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
9  && (make -j4 -C test/api check || cat test/api/test-suite.log))
10
11# slower sanity check
12time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
13   && make -j4 -C src check \
14   && make -j4 -C test/api check \
15   && make -j4 -C test/subset check)
16
17# confirm you didn't break anything else
18time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
19  && make -j4 check)
20
21# often catches files you didn't add, e.g. test fonts to EXTRA_DIST
22make distcheck
23```
24
25### Run tests with asan
26
27**NOTE**: this sometimes yields harder to read results than the full fuzzer
28
29```shell
30# For nice symbols tell asan how to symoblize. Note that it doesn't like versioned copies like llvm-symbolizer-3.8
31# export ASAN_SYMBOLIZER_PATH=path to version-less llvm-symbolizer
32# ex
33export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-3.8/bin/llvm-symbolizer
34
35./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address
36# make/run tests as usual
37```
38
39### Debug with GDB
40
41```
42cd ./util
43../libtool --mode=execute gdb --args ./hb-subset ...
44```
45
46### Enable Debug Logging
47
48```shell
49# make clean if you previously build w/o debug logging
50make CPPFLAGS=-DHB_DEBUG_SUBSET=100
51```
52
53## Build and Test via CMake
54
55Note: You'll need to first install ninja-build via apt-get.
56
57```shell
58cd harfbuzz
59mkdir buid
60cmake -DHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test
61```
62## Test with the Fuzzer
63
64```shell
65# push your changs to a branch on googlefonts/harfbuzz
66# In a local copy of oss-fuzz, edit projects/harfbuzz/Dockerfile
67# Change the git clone to pull your branch
68
69# Do this periodically
70sudo python infra/helper.py build_image harfbuzz
71
72# Do these to update/run
73sudo python infra/helper.py build_fuzzers --sanitizer address harfbuzz
74sudo python infra/helper.py run_fuzzer harfbuzz hb-subset-fuzzer
75```
76
77## Profiling
78
79```
80make clean
81./configure CXXFLAGS="-fno-omit-frame-pointer -g"
82make
83perf record -o <perf output file> -g <command to run>
84perf report -i<perf output file>
85```
86
87