Skip to content

Commit 8ab1ac7

Browse files
author
Marcello Seri
committed
coverage: be less smart
Copy over all the files, include all folders and avoid using arrays. Signed-off-by: Marcello Seri <[email protected]>
1 parent 109234a commit 8ab1ac7

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

.coverage.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,33 @@ mkdir -p $COVERAGE_DIR
88
pushd $COVERAGE_DIR
99
if [ -z "$KEEP" ]; then trap "popd; rm -rf $COVERAGE_DIR" EXIT; fi
1010

11+
# copy over everything
1112
$(which cp) -r ../* .
1213

14+
# prepare the environment
15+
eval `opam config env`
1316
opam install bisect_ppx ocveralls -y
1417

18+
# run the tests with coverage enabled
1519
export BISECT_ENABLE=YES
1620
jbuilder runtest
1721

18-
outs=$(find . | grep bisect.*.out)
19-
bisect-ppx-report -I $(dirname $outs[1]) -text report $outs
20-
bisect-ppx-report -I $(dirname $outs[1]) -summary-only -text summary $outs
21-
if [ -n "$HTML" ]; then bisect-ppx-report -I $(dirname $outs[1]) -html ../html-report $outs; fi
22+
# move all bisect files here
23+
find . -name 'bisect*.out' -exec mv {} . \;
24+
25+
DIRECTORIES=$(find _build/default -type d -not -path '*/\.*')
26+
printf -v INCLUDES " -I %s" $DIRECTORIES
27+
28+
bisect-ppx-report bisect*.out $INCLUDES -text report
29+
bisect-ppx-report bisect*.out $INCLUDES -summary-only -text summary
30+
bisect-ppx-report bisect*.out $INCLUDES -html report-html
2231

2332
if [ -n "$TRAVIS" ]; then
2433
echo "\$TRAVIS set; running ocveralls and sending to coveralls.io..."
25-
ocveralls --prefix _build/default $outs --send
34+
ocveralls --prefix _build/default bisect*.out --send
2635
else
27-
echo "\$TRAVIS not set; displaying results of bisect-report..."
36+
echo "\$TRAVIS not set; displaying results of bisect-ppx-report..."
2837
cat report
2938
cat summary
3039
fi
40+

0 commit comments

Comments
 (0)