| 1 | #!/usr/bin/env bash |
| 2 | set -eu |
| 3 | cd -- "$(dirname -- "$0")" |
| 4 | cd .. |
| 5 | |
| 6 | red=$'\033[0;31m' |
| 7 | # No Color |
| 8 | nc=$'\033[0m' |
| 9 | green=$'\033[0;32m' |
| 10 | bold="$(tput bold)" |
| 11 | normal="$(tput sgr0)" |
| 12 | passed_start="${green}${bold}PASSED:${normal}${nc} " |
| 13 | passed_end="" |
| 14 | failed_start="${red}${bold}FAILED:${normal} ${red}" |
| 15 | failed_end="${nc}" |
| 16 | |
| 17 | failed_count=0 |
| 18 | total_count=0 |
| 19 | |
| 20 | while IFS= read -r line; do |
| 21 | total_count=$((total_count + 1)) |
| 22 | eval "${line}" 2>/dev/null >/dev/null && echo "${passed_start}${line}${passed_end}" || { |
| 23 | echo "${failed_start}${line}${failed_end}"; |
| 24 | failed_count=$((failed_count + 1)) |
| 25 | }; |
| 26 | done < <(fiat-amd64/gentest.py fiat-amd64/fiat_*) |
| 27 | |
| 28 | if [[ ${failed_count} == 0 ]]; then |
| 29 | echo "${green}${bold}ALL ${total_count} TESTS PASSED${normal}${nc}" |
| 30 | else |
| 31 | echo "${green}${bold}PASSED:${normal}${green} $((total_count - failed_count))${nc} / ${total_count}" |
| 32 | echo "${red}${bold}FAILED:${normal}${red} ${failed_count}${nc} / ${total_count}" |
| 33 | exit 1 |
| 34 | fi |