Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage: be less smart #199

Merged
merged 3 commits into from
Jan 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 '*/\.*')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this is meant to exclude, are there some hidden directories under _build?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, .ppx with the rewriters. It is not necessary though, just nicer output

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