#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
tmo_kernel_case=$(find "${SCRIPT_DIR}" -name "test_*.py")
coverage=${1}

for sc in ${tmo_kernel_case}
do
echo -n "${sc}    "
echo -n "Testing...."
if [ "${coverage}" = "coverage" ];then
coverage run -a ${sc}
else
python3 "${sc}" > "/tmp/$(basename ${sc}).log" 2>&1
fi
if [ $? == 0 ];then
echo -e "\033[32m success \033[0m"
else
echo -e "\033[31m failed \033[0m"
fi
done
echo "End of pytest..."
