Page MenuHomec4science

run_tests.sh
No OneTemporary

File Metadata

Created
Mon, Jun 3, 16:17

run_tests.sh

#!/bin/bash
#########################################################################
function test_output {
name=$( basename -s .verified $1 )
echo "Testing $name ouput"
echo -n "------------ "
diff $name.out $name.verified >/dev/null 2>&1
return $?
}
#########################################################################
function test_return {
name=$( basename -s .py $1 )
echo "Testing $name.py"
echo -n "------------ "
PYTHONPATH=../python python $name.py 2>/dev/null > $name.out
return $?
}
#########################################################################
tamaas_path=$(PYTHONPATH=../python python -c 'import tamaas; print tamaas' | cut -d "'" -f 4 )
echo "Tamaas test suite"
echo "================="
echo ""
echo "importing tamaas from $tamaas_path"
echo ""
n_tests=0
passed_tests=0
for test_file in test_*.py; do
((n_tests++))
test_return $test_file
result=$?
if [ $result -ne 0 ]; then
echo "failure"
else
echo "success"
((passed_tests++))
fi
done
for test_file in test_*.verified; do
((n_tests++))
test_output $test_file
result=$?
if [ $result -ne 0 ]; then
echo "failure"
else
echo "success"
((passed_tests++))
fi
done
failed_tests=$((n_tests - passed_tests))
echo ""
echo "Test results :"
echo " - passed $passed_tests/$n_tests"
echo " - failed $failed_tests/$n_tests"

Event Timeline