run-all-extension-tests revision 83aaf46c9feab529aeb9add871c05c3d1177afcc
7207N/A#!/bin/bash
7207N/A
7207N/Aecho -e "\n##### Extension Tests #####"
7207N/A
7207N/Acd "$(dirname "$0")"
7207N/A
7207N/Ahas_py_coverage=false
7207N/Apy_cover_files=$( mktemp )
7207N/Afailed_tests=$( mktemp )
7207N/A
7207N/Aif coverage.py -e >/dev/null 2>/dev/null; then
7207N/A has_py_coverage=true
7207N/A cover_py_cmd=coverage.py
7207N/Aelse
7207N/A if coverage -e >/dev/null 2>/dev/null; then
7207N/A has_py_coverage=true
7207N/A cover_py_cmd=coverage
7207N/A fi
7207N/Afi
7207N/A
7207N/A#if $has_py_coverage; then
7207N/A# $cover_py_cmd -e
7207N/A#fi
7207N/A
7207N/Afunction run_py_test() {
7207N/A echo -e "\n>> Testing $1"
7207N/A if $has_py_coverage; then
7207N/A if ! $cover_py_cmd -x "$1.test.py"; then
7207N/A echo "$1" >> $failed_tests
7207N/A fi
7207N/A echo "../$1.py" >> $py_cover_files
7207N/A else
7207N/A if ! python "$1.test.py"; then
7207N/A echo "$1" >> $failed_tests
7207N/A fi
7207N/A fi
7207N/A return 0
7207N/A}
7228N/A
7228N/Atot_FAILED=0
7228N/A
7207N/Afor testFile in *.test.py; do
7207N/A if ! run_py_test $( echo $testFile | sed -r 's/^([^.]+)..*$/\1/' ); then
7207N/A let tot_FAILED++
7207N/A fi
7207N/Adone
7207N/A
7207N/Aif $has_py_coverage; then
7207N/A echo -e "\n>> Coverage Report:"
7207N/A cat $py_cover_files | xargs $cover_py_cmd -r
7207N/Afi
7207N/A
7207N/Afail=false
7207N/Aif ! test -z "$( cat $failed_tests )"; then
7207N/A echo -e "\nFailed extension tests:"
7207N/A cat $failed_tests | sed 's/^/ - /'
7207N/A fail=true
7207N/Afi
7207N/Aecho ""
7207N/A
7207N/Arm $py_cover_files $failed_tests
7207N/A
7207N/A$fail && exit 1