Skip to content

Commit

Permalink
Merge pull request #199 from mseri/fix-coverage
Browse files Browse the repository at this point in the history
coverage: be less smart
  • Loading branch information
mseri authored Jan 31, 2018
2 parents 109234a + de8ceb1 commit 9a22558
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions .coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,33 @@ mkdir -p $COVERAGE_DIR
pushd $COVERAGE_DIR
if [ -z "$KEEP" ]; then trap "popd; rm -rf $COVERAGE_DIR" EXIT; fi

# copy over everything
$(which cp) -r ../* .

# prepare the environment
eval `opam config env`
opam install bisect_ppx ocveralls -y

# run the tests with coverage enabled
export BISECT_ENABLE=YES
jbuilder runtest

outs=$(find . | grep bisect.*.out)
bisect-ppx-report -I $(dirname $outs[1]) -text report $outs
bisect-ppx-report -I $(dirname $outs[1]) -summary-only -text summary $outs
if [ -n "$HTML" ]; then bisect-ppx-report -I $(dirname $outs[1]) -html ../html-report $outs; fi
# move all bisect files here
find . -name 'bisect*.out' -exec mv {} . \;

DIRECTORIES=$(find _build/default -type d -not -path '*/\.*')
printf -v INCLUDES " -I %s" $DIRECTORIES

bisect-ppx-report bisect*.out $INCLUDES -text report
bisect-ppx-report bisect*.out $INCLUDES -summary-only -text summary
bisect-ppx-report bisect*.out $INCLUDES -html report-html

if [ -n "$TRAVIS" ]; then
echo "\$TRAVIS set; running ocveralls and sending to coveralls.io..."
ocveralls --prefix _build/default $outs --send
ocveralls --prefix _build/default bisect*.out --send
else
echo "\$TRAVIS not set; displaying results of bisect-report..."
echo "\$TRAVIS not set; displaying results of bisect-ppx-report..."
cat report
cat summary
fi

0 comments on commit 9a22558

Please sign in to comment.