#!/bin/sh

if [ ! -f "test_basics.py" ]; then
  if [ -d "test" ]; then
    cd test
  else
    echo "Couldn't find Optik test scripts!" >&2
    exit 1
  fi
fi  

fail=""
for test in test*.py ; do
  echo "** $test"
  python $test
  if [ $? -ne 0 ] ; then
    echo "** FAIL: $test"
    fail="$fail$test "
  fi
done

if [ "$fail" ]; then
  echo "FAILED: $fail"
  exit 1
else
  echo "No test scripts crashed."
fi
