2019-04-23 11:18:42 +00:00
|
|
|
#!/bin/bash
|
2019-03-14 23:03:53 +00:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2019-04-23 11:18:42 +00:00
|
|
|
### PyPy does not run the test suite ###########################################
|
|
|
|
|
|
|
|
if [[ $FEATURES == *"pypy"* ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-04-18 16:12:17 +00:00
|
|
|
### Run kcov ###################################################################
|
2019-03-14 23:03:53 +00:00
|
|
|
|
|
|
|
rm -f target/debug/pyo3*.d
|
|
|
|
rm -f target/debug/test_*.d
|
|
|
|
rm -f target/debug/test_doc-*
|
|
|
|
|
2019-04-18 16:12:17 +00:00
|
|
|
# Note: On travis this is run with -P1 because it started failing with
|
|
|
|
# `-P $(nproc)`. kcov can probably be run in parallel if used with different CI
|
2019-03-14 23:03:53 +00:00
|
|
|
FILES=$(find . -path ./target/debug/pyo3\* -or -path ./target/debug/test_\*)
|
2019-04-18 14:41:45 +00:00
|
|
|
echo $FILES | xargs -n1 -P1 sh -c '
|
2019-03-14 23:03:53 +00:00
|
|
|
dir="target/cov/$(basename $@)"
|
|
|
|
mkdir -p $dir
|
|
|
|
echo "Collecting coverage data of $(basename $@)"
|
|
|
|
kcov \
|
|
|
|
--exclude-path=./tests \
|
|
|
|
--exclude-region="#[cfg(test)]:#[cfg(testkcovstopmarker)]" \
|
|
|
|
--exclude-pattern=/.cargo,/usr/lib \
|
|
|
|
--verify $dir "$@" 2>&1 >/dev/null
|
|
|
|
' _
|
|
|
|
|
|
|
|
### Upload coverage ############################################################
|
|
|
|
|
|
|
|
echo "Uploading code coverage"
|
|
|
|
curl -SsL https://codecov.io/bash | bash
|