#!/bin/sh # # Copyright (C) 2004, 2005, 2006 Mekensleep # # Mekensleep # 24 rue vieille du temple # 75004 Paris # licensing@mekensleep.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Authors: # Loic Dachary # Henry Precheur (2004) # # set -e : ${srcdir:=.} export srcdir : ${top_srcdir:=..} export top_srcdir #DEFAULT_VERBOSE_T=-1 # show the test results automake level, hide error messages #DEFAULT_VERBOSE_T=0 # show the test results unittest level, hide informative messages DEFAULT_VERBOSE_T=3 # show very detailed information about everything (~2MB output 2006/07) : ${VERBOSE_T:=$DEFAULT_VERBOSE_T} export VERBOSE_T DEFAULT_COVERAGE_FILES=$(echo ${top_srcdir}/pokerengine/*.py) : ${COVERAGE_FILES:=$DEFAULT_COVERAGE_FILES} case "$1" in *coverage-reset) @PYTHON@ ${srcdir}/coverage.py -e ;; *coverage-report) output=$( @PYTHON@ ${srcdir}/coverage.py -m -r ${COVERAGE_FILES} ) rm -fr annotated ; mkdir annotated @PYTHON@ ${srcdir}/coverage.py -a -d annotated ${COVERAGE_FILES} echo "$output" # # Don't bark on coverage being incomplete when not verbose : # print statements are omited. # if test "$VERBOSE_T" == "3" ; then if ! echo "$output" | grep 'TOTAL.*100%' > /dev/null ; then echo 'FAIL: tests do not cover 100% of the poker-engine code' exit 1 fi fi ;; *.py) @PYTHON@ -u ${srcdir}/coverage.py -x "$1" ;; *) echo unknown test $1 exit 1 ;; esac