#!/bin/bash

tests=`ls *.py | grep -v run_expects`

sh_tests='tilelink_unit_test.sh'

trap '{ echo "Exiting on SIGINT." ; exit 1; }' INT

errors=0
for x in $tests; do
    echo ${x/.py/} ...
    if timeout 100 python $x > ${x/.py/.log} 2>&1 ; then
        echo PASS
    else
        echo FAIL
        (( errors += 1 ))
    fi
done


for x in $sh_tests; do
    echo $x ...
    if timeout 100 ./$x ; then
        echo PASS
    else
        echo FAIL
        (( errors += 1 ))
    fi
done


echo "errors: $errors"
