[e23356]: Test / testTest Maximize Restore History

Download this file

testTest    77 lines (66 with data), 1.5 kB

#!/bin/bash

# testTest [-p python_command] [ errorfiles_file ]
#
# no arguments.
#
# run in Test directory to test all .tst files.
# 
# exit status > 0 if errors found.

ERRORFILES="/tmp/testTest.$$"

PYTHON="python2.5 -Wd"

# Go to Test directory:
cd `dirname "$0"`

# Add parent directory to PYTHONPATH:
parent_dir=$(dirname $(pwd))
if [ "$PYTHONPATH" ]
then
    export PYTHONPATH="$parent_dir:$PYTHONPATH"
else
    export PYTHONPATH="$parent_dir"
fi

if [ $# -ge 2 -a "x$1" = x-p ]
then
    PYTHON="$2"
    shift 2
fi

> $ERRORFILES
NUM_ERRORS=0

for f in `find . -name .svn -prune -o -name '*.tst' -print`
do
    #echo Testing "$f"
    if ! $PYTHON ../doctest_file.py "$f" True
    then
        echo "$f" >> $ERRORFILES
        NUM_ERRORS=$(($NUM_ERRORS + 1))
    fi
done

if ! $PYTHON setup.py --quiet bdist_egg
then
    echo "setup.py" >> $ERRORFILES
    NUM_ERRORS=$(($NUM_ERRORS + 1))
else
    cd ..
    if ! PYTHONPATH=`echo Test/dist/CanNotProve*.egg` $PYTHON doctest_file.py \
           Test/CanNotProve/CanNotProve.tst2
    then
        echo "CanNotProve/CanNotProve.tst2" >> $ERRORFILES
        NUM_ERRORS=$(($NUM_ERRORS + 1))
    else
        rm -rf Test/CanNotProve.egg-info Test/build Test/dist
    fi
    cd Test
fi

if [ $NUM_ERRORS -eq 0 ]
then
    echo "No Errors!"
    rm -f $ERRORFILES
else
    echo "********** ERRORS ************* $NUM_ERRORS files had errors:"
    cat $ERRORFILES
    if [ $# -gt 0 ]
    then
        sed 's,^\./,Test/,' $ERRORFILES >> "$1"
    fi
    rm -f $ERRORFILES
    exit $NUM_ERRORS
fi