From 87f4aada9964d4eff92de50fa2cd3708c81b5066 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 30 Jul 2020 15:20:17 +0430 Subject: [PATCH] [docs] Update TESTING.md with meson --- TESTING.md | 67 ++++++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 48 deletions(-) diff --git a/TESTING.md b/TESTING.md index d70da070a..33f9910d2 100644 --- a/TESTING.md +++ b/TESTING.md @@ -4,82 +4,53 @@ Depending on what area you are working in change or add `HB_DEBUG_`. Values defined in `hb-debug.hh`. ```shell -# quick sanity check -time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \ - && (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 +CPPFLAGS='-DHB_DEBUG_SUBSET=100' meson setup build +meson test -C build ``` ### Run tests with asan -**NOTE**: this sometimes yields harder to read results than the full fuzzer - ```shell -# 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 - -./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address -# make/run tests as usual +meson setup build -Db_sanitize=address +meson compile -C build ``` ### Debug with GDB ``` -cd ./util -../libtool --mode=execute gdb --args ./hb-subset ... +meson setup build +meson compile -C build +meson test --gdb testname ``` ### Enable Debug Logging ```shell -# make clean if you previously build w/o debug logging -make CPPFLAGS=-DHB_DEBUG_SUBSET=100 +CPPFLAGS=-DHB_DEBUG_SUBSET=100 meson build +ninja -C build ``` -## Build and Test via CMake - -Note: You'll need to first install ninja-build via apt-get. +## Build and Test ```shell -meson build && ninja -Cbuild && ninja -Cbuild test +meson build +ninja -Cbuild +ninja -Cbuild test ``` ## 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 - -# 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 +CXXFLAGS="-fsanitize=address,fuzzer-no-link" meson build --default-library=static -Dfuzzer_ldflags="-fsanitize=address,fuzzer" -Dexperimental_api=true +ninja -C build test/fuzzing/hb-{shape,draw,subset,set}-fuzzer +build/test/fuzzing/hb-subset-fuzzer ``` ## Profiling ``` -make clean -./configure CXXFLAGS="-fno-omit-frame-pointer -g" -make -perf record -o -g -perf report -i +meson build +meson compile -C build +build/perf/perf ```