1#!/bin/sh
2#
3# makes a coverage build.
4#
5# To measure and display the coverage:
6#
7#cd build-coverage
8#fuzz/fuzz_parser path/to/corpus/* # repeat with other fuzzers
9#gcovr -r . --html --html-details --sort-uncovered -o out.html
10# and view the results in out.html
11
12bdir=build-coverage
13if [ ! -d $bdir ] ; then
14    mkdir -p $bdir
15    cd $bdir
16
17    export CC=gcc
18    export CXX="g++"
19    export CFLAGS="-fprofile-arcs -ftest-coverage"
20    export CXXFLAGS="-fprofile-arcs -ftest-coverage"
21    export LDFLAGS="-fprofile-arcs -ftest-coverage"
22
23    cmake .. \
24          -GNinja \
25          -DCMAKE_BUILD_TYPE=Debug \
26          -DSIMDJSON_BUILD_STATIC=On \
27          -DENABLE_FUZZING=On \
28          -DSIMDJSON_DISABLE_DEPRECATED_API=On \
29	  -DSIMDJSON_FUZZ_LINKMAIN=On
30    ninja all_fuzzers
31    cd ..
32fi
33
34
35
36