blob: 94be3a0a7f7a843048a9d9f49f445ff3d546b6cf [file] [log] [blame] [view]
Roderick Sheeter00946ca2019-05-08 09:42:35 -07001## 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
rsheeter1b58bf22019-05-09 20:06:29 -07008time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
rsheeterd8a49b52019-05-10 16:52:43 -07009 && (make -j4 -C test/api check || cat test/api/test-suite.log))
Roderick Sheeter00946ca2019-05-08 09:42:35 -070010
rsheeter1b58bf22019-05-09 20:06:29 -070011# 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)
Roderick Sheeter00946ca2019-05-08 09:42:35 -070016
17# confirm you didn't break anything else
rsheeter1b58bf22019-05-09 20:06:29 -070018time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
19 && make -j4 check)
Roderick Sheeter00946ca2019-05-08 09:42:35 -070020
21# often catches files you didn't add, e.g. test fonts to EXTRA_DIST
22make distcheck
23```
24
rsheeterd8a49b52019-05-10 16:52:43 -070025### Run tests with asan
26
rsheeterf49a5be2019-05-20 20:45:11 -070027**NOTE**: this sometimes yields harder to read results than the full fuzzer
28
rsheeterd8a49b52019-05-10 16:52:43 -070029```shell
rsheetera0febba2019-05-16 15:58:49 -070030# 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
rsheeterd8a49b52019-05-10 16:52:43 -070035./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address
36# make/run tests as usual
37```
38
Roderick Sheeter00946ca2019-05-08 09:42:35 -070039### 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```
rsheeter40631812019-05-08 09:47:34 -070062## 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
rsheeterf49a5be2019-05-20 20:45:11 -070068
69# Do this periodically
rsheeter40631812019-05-08 09:47:34 -070070sudo python infra/helper.py build_image harfbuzz
rsheeterf49a5be2019-05-20 20:45:11 -070071
72# Do these to update/run
rsheeter40631812019-05-08 09:47:34 -070073sudo python infra/helper.py build_fuzzers --sanitizer address harfbuzz
74sudo python infra/helper.py run_fuzzer harfbuzz hb-subset-fuzzer
75```
Garret Riegercf414e32019-09-27 09:55:17 -070076
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