Add scripts for writing test coverage (works in progress) and MANIFEST.

This commit is contained in:
Daniel Nichter
2011-07-15 15:55:10 -06:00
parent a932d56d75
commit 5a087dcff6
3 changed files with 141 additions and 0 deletions

45
MANIFEST Normal file
View File

@@ -0,0 +1,45 @@
COPYING
Changelog
INSTALL
MANIFEST
Makefile.PL
README
bin/pt-align
bin/pt-archiver
bin/pt-checksum-filter
bin/pt-collect
bin/pt-config-diff
bin/pt-deadlock-logger
bin/pt-diskstats
bin/pt-duplicate-key-checker
bin/pt-fifo-split
bin/pt-find
bin/pt-fk-error-logger
bin/pt-heartbeat
bin/pt-index-usage
bin/pt-kill
bin/pt-log-player
bin/pt-mext
bin/pt-mysql-summary
bin/pt-online-schema-change
bin/pt-pmp
bin/pt-profile-compact
bin/pt-query-advisor
bin/pt-query-digest
bin/pt-query-profiler
bin/pt-rel
bin/pt-show-grants
bin/pt-sift
bin/pt-slave-delay
bin/pt-slave-find
bin/pt-slave-restart
bin/pt-stalk
bin/pt-summary
bin/pt-table-checksum
bin/pt-table-sync
bin/pt-tcp-model
bin/pt-trend
bin/pt-upgrade
bin/pt-usl
bin/pt-variable-advisor
bin/pt-visual-explain

32
util/parse-cover-report Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env awk -f
/^File/ {
line_fmt="%-30s %5s %5s %5s %5s %5s\n";
while ( getline && $0 !~ /^Total/ ) {
if ( $1 ~ /\.pm/ ) {
n=split($1, path, "/")
printf("Test coverage for Percona Toolkit %s on ", path[n]);
system("date -u +'%F %T UTC'");
print ""
printf(line_fmt, "File", "stmt", "bran", "cond", "sub", "total");
printf(line_fmt, "------------------------------", "-----", "-----", "-----", "-----", "-----");
printf(line_fmt, path[n], $2, $3, $4, $5, $7)
break;
}
}
print ""
while ( $0 !~ /^line/ ) {
getline
}
print
while ( getline ) {
print
}
exit
}

64
util/write-test-coverage Executable file
View File

@@ -0,0 +1,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