Skip to content

Instantly share code, notes, and snippets.

@MasWag
Created November 20, 2014 03:48
Show Gist options
  • Save MasWag/ffae9e453fa38f56498e to your computer and use it in GitHub Desktop.
Save MasWag/ffae9e453fa38f56498e to your computer and use it in GitHub Desktop.
simple test launcher.
#!/bin/sh
# please change this variable when test target is changed
tests="fadd_isim i2f_isim"
ERROR_MES="User(VHDL) Code Called Simulation Stop"
NUM=$(echo $tests | wc -w)
PASSED="0"
FAILED="0"
if [ $NUM -eq 1 ]; then
echo -e "\e[32m[==========]\e[0m Running 1 test";
else
echo -e "\e[32m[==========]\e[0m Running $NUM tests";
fi
for a in $tests; do
echo -e "\e[32m[ RUN ]\e[0m $a";
if echo "run all" | ./$a | grep "$ERROR_MES" > /dev/null; then
echo -e "\e[31m[ FAILED ]\e[0m $a";
FAILED=$(( $FAILED + 1));
else
echo -e "\e[32m[ PASSED ]\e[0m $a";
PASSED=$(( $PASSED + 1));
fi;
done
echo -e "\e[32m[==========]\e[0m";
if [ $PASSED -eq 1 ]; then
echo -e "\e[32m[ PASSED ]\e[0m $PASSED test.";
elif [ $PASSED -gt 1 ]; then
echo -e "\e[32m[ PASSED ]\e[0m $PASSED tests.";
fi;
if [ $FAILED -eq 1 ]; then
echo -e "\e[31m[ FAILED ]\e[0m $FAILED test.";
elif [ $FAILED -gt 1 ]; then
echo -e "\e[31m[ FAILED ]\e[0m $FAILED tests.";
else
exit 0;
fi;
exit 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment