TESTING.md 1.9 KB
Newer Older
1 2 3 4 5 6 7
## 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
R
rsheeter 已提交
8
time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
R
rsheeter 已提交
9
  && (make -j4 -C test/api check || cat test/api/test-suite.log))
10

R
rsheeter 已提交
11 12 13 14 15
# 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)
16 17

# confirm you didn't break anything else
R
rsheeter 已提交
18 19
time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \
  && make -j4 check)
20 21 22 23 24

# often catches files you didn't add, e.g. test fonts to EXTRA_DIST
make distcheck
```

R
rsheeter 已提交
25 26 27
### Run tests with asan

```shell
R
rsheeter 已提交
28 29 30 31 32
# 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

R
rsheeter 已提交
33 34 35 36
./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address
# make/run tests as usual
```

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
### 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
cd harfbuzz
mkdir buid
cmake -DHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test
```
60 61 62 63 64 65 66 67 68 69
## 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
sudo python infra/helper.py build_image harfbuzz
sudo python infra/helper.py build_fuzzers --sanitizer address harfbuzz
sudo python infra/helper.py run_fuzzer harfbuzz hb-subset-fuzzer
```