mirror of
https://github.com/gonum/gonum.git
synced 2025-10-29 17:51:54 +08:00
Create test-coverage.sh
This commit is contained in:
30
test-coverage.sh
Normal file
30
test-coverage.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# based on http://stackoverflow.com/questions/21126011/is-it-possible-to-post-coverage-for-multiple-packages-to-coveralls
|
||||
# with script found at https://github.com/gopns/gopns/blob/master/test-coverage.sh
|
||||
|
||||
echo "mode: set" > acc.out
|
||||
for Dir in $(find ./* -maxdepth 10 -type d );
|
||||
do
|
||||
if ls $Dir/*.go &> /dev/null;
|
||||
then
|
||||
returnval=`go test -v -coverprofile=profile.out $Dir`
|
||||
echo ${returnval}
|
||||
if [[ ${returnval} != *FAIL* ]]
|
||||
then
|
||||
if [ -f profile.out ]
|
||||
then
|
||||
cat profile.out | grep -v "mode: set" >> acc.out
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$COVERALLS_TOKEN" ]
|
||||
then
|
||||
$HOME/gopath/bin/goveralls -coverprofile=acc.out -service=travis-ci -repotoken $COVERALLS_TOKEN
|
||||
fi
|
||||
|
||||
rm -rf ./profile.out
|
||||
rm -rf ./acc.out
|
||||
Reference in New Issue
Block a user