~percona-toolkit-dev/percona-toolkit/mysql-5.6-test-fixes

« back to all changes in this revision

Viewing changes to util/write-test-coverage

  • Committer: Daniel Nichter
  • Date: 2011-07-15 21:55:10 UTC
  • Revision ID: daniel@percona.com-20110715215510-f84y0rooz5k7m2i0
Add scripts for writing test coverage (works in progress) and MANIFEST.

Show diffs side-by-side

added added

removed removed

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