[docs] Update TESTING.md with meson

This commit is contained in:
Ebrahim Byagowi 2020-07-30 15:20:17 +04:30 committed by GitHub
parent 15644ee60e
commit 87f4aada99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 48 deletions

View File

@ -4,82 +4,53 @@ Depending on what area you are working in change or add `HB_DEBUG_<whatever>`.
Values defined in `hb-debug.hh`. Values defined in `hb-debug.hh`.
```shell ```shell
# quick sanity check CPPFLAGS='-DHB_DEBUG_SUBSET=100' meson setup build
time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \ meson test -C build
&& (make -j4 -C test/api check || cat test/api/test-suite.log))
# 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
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
``` ```
### Run tests with asan ### Run tests with asan
**NOTE**: this sometimes yields harder to read results than the full fuzzer
```shell ```shell
# For nice symbols tell asan how to symoblize. Note that it doesn't like versioned copies like llvm-symbolizer-3.8 meson setup build -Db_sanitize=address
# export ASAN_SYMBOLIZER_PATH=path to version-less llvm-symbolizer meson compile -C build
# ex
export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-3.8/bin/llvm-symbolizer
./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address
# make/run tests as usual
``` ```
### Debug with GDB ### Debug with GDB
``` ```
cd ./util meson setup build
../libtool --mode=execute gdb --args ./hb-subset ... meson compile -C build
meson test --gdb testname
``` ```
### Enable Debug Logging ### Enable Debug Logging
```shell ```shell
# make clean if you previously build w/o debug logging CPPFLAGS=-DHB_DEBUG_SUBSET=100 meson build
make CPPFLAGS=-DHB_DEBUG_SUBSET=100 ninja -C build
``` ```
## Build and Test via CMake ## Build and Test
Note: You'll need to first install ninja-build via apt-get.
```shell ```shell
meson build && ninja -Cbuild && ninja -Cbuild test meson build
ninja -Cbuild
ninja -Cbuild test
``` ```
## Test with the Fuzzer ## Test with the Fuzzer
```shell ```shell
# push your changs to a branch on googlefonts/harfbuzz CXXFLAGS="-fsanitize=address,fuzzer-no-link" meson build --default-library=static -Dfuzzer_ldflags="-fsanitize=address,fuzzer" -Dexperimental_api=true
# In a local copy of oss-fuzz, edit projects/harfbuzz/Dockerfile ninja -C build test/fuzzing/hb-{shape,draw,subset,set}-fuzzer
# Change the git clone to pull your branch build/test/fuzzing/hb-subset-fuzzer
# Do this periodically
sudo python infra/helper.py build_image harfbuzz
# 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 ## Profiling
``` ```
make clean meson build
./configure CXXFLAGS="-fno-omit-frame-pointer -g" meson compile -C build
make build/perf/perf
perf record -o <perf output file> -g <command to run>
perf report -i<perf output file>
``` ```