1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/usr/bin/env bash
#
# WORK IN PROGRESS -- Do not use yet.
#
# ############################################################################
# Standard startup, find the branch's root directory
# ############################################################################
exit_status=0
die() {
echo $1 >&2
exit 1
}
warn() {
echo $1 >&2
exit_status=1
}
if [ -n "$PERCONA_TOOLKIT_BRANCH" ]; then
BRANCH=$PERCONA_TOOLKIT_BRANCH
else
while [ ! -f Makefile.PL ] && [ $(pwd) != "/" ]; do
cd ..
done
if [ ! -f Makefile.PL ]; then
die "Cannot find the root directory of the Percona Toolkit branch"
fi
BRANCH=`pwd`
fi
# ############################################################################
# Paths
# ############################################################################
DOCS=$BRANCH/docs/test-coverage
DB=$DOCS/db
HTML=$DOCS/html
# ############################################################################
# Subroutines
# ############################################################################
test_coverage() {
rm -rf $DB/*
file="Advisor.pm"
test_file="Advisor.t"
cd $BRANCH/t/lib
prove --perl "perl -MDevel::Cover=-silent,1,-db,$DB,-ignore,.+,-select,$file" $test_file
cover -report text $DB | $BRANCH/util/parse-cover-report > $DOCS/$file
echo "Wrote $DOCS/$file"
}
# ###########################################################################
# Script starts here
# ###########################################################################
test_coverage
exit $exit_status
|