...
1#!/bin/bash
2
3set -o errexit
4set -o nounset
5set -o pipefail
6
7ROOT=$(dirname "${BASH_SOURCE}")/..
8
9# Some useful colors.
10if [[ -z "${color_start-}" ]]; then
11 declare -r color_start="\033["
12 declare -r color_red="${color_start}0;31m"
13 declare -r color_yellow="${color_start}0;33m"
14 declare -r color_green="${color_start}0;32m"
15 declare -r color_norm="${color_start}0m"
16fi
17
18SILENT=true
19
20function is-excluded {
21 for e in $EXCLUDE; do
22 if [[ $1 -ef ${BASH_SOURCE} ]]; then
23 return
24 fi
25 if [[ $1 -ef "$ROOT/hack/$e" ]]; then
26 return
27 fi
28 done
29 return 1
30}
31
32while getopts ":v" opt; do
33 case $opt in
34 v)
35 SILENT=false
36 ;;
37 \?)
38 echo "Invalid flag: -$OPTARG" >&2
39 exit 1
40 ;;
41 esac
42done
43
44if $SILENT ; then
45 echo "Running in the silent mode, run with -v if you want to see script logs."
46fi
47
48EXCLUDE="all.sh"
49
50ret=0
51for t in `ls $ROOT/verify/*.sh`
52do
53 if is-excluded $t ; then
54 echo "Skipping $t"
55 continue
56 fi
57 if $SILENT ; then
58 echo -e "Verifying $t"
59 if bash "$t" &> /dev/null; then
60 echo -e "${color_green}SUCCESS${color_norm}"
61 else
62 echo -e "${color_red}FAILED${color_norm}"
63 ret=1
64 fi
65 else
66 bash "$t" || ret=1
67 fi
68done
69exit $ret
View as plain text