blob: d77638577768a60bdea750534091a5b43bbf18f1 [file] [log] [blame]
Todd Willey2599b312011-11-04 10:31:37 -04001#!/usr/bin/env bash
2
3# Run everything in the exercises/ directory that isn't explicitly disabled
4
5# comma separated list of script basenames to skip
6# to refrain from exercising euca.sh use SKIP_EXERCISES=euca
7SKIP_EXERCISES=${SKIP_EXERCISES:-""}
8
Todd Willey9e9132d2011-11-04 12:09:54 -04009# Locate the scripts we should run
Todd Willey2599b312011-11-04 10:31:37 -040010EXERCISE_DIR=$(dirname "$0")/exercises
11basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done)
12
Todd Willey9e9132d2011-11-04 12:09:54 -040013# Track the state of each script
14passes=""
15failures=""
16skips=""
17
18# Loop over each possible script (by basename)
Todd Willey2599b312011-11-04 10:31:37 -040019for script in $basenames ; do
20 if [[ "$SKIP_EXERCISES" =~ $script ]] ; then
Todd Willey9e9132d2011-11-04 12:09:54 -040021 skips="$skips $script"
Todd Willey2599b312011-11-04 10:31:37 -040022 else
Todd Willey9e9132d2011-11-04 12:09:54 -040023 echo =========================
Todd Willey2599b312011-11-04 10:31:37 -040024 echo Running $script
Todd Willey9e9132d2011-11-04 12:09:54 -040025 echo =========================
26 $EXERCISE_DIR/$script.sh
Todd Willey2599b312011-11-04 10:31:37 -040027 if [[ $? -ne 0 ]] ; then
Todd Willey9e9132d2011-11-04 12:09:54 -040028 failures="$failures $script"
Todd Willey2599b312011-11-04 10:31:37 -040029 else
Todd Willey9e9132d2011-11-04 12:09:54 -040030 passes="$passes $script"
Todd Willey2599b312011-11-04 10:31:37 -040031 fi
32 fi
33done
Todd Willey9e9132d2011-11-04 12:09:54 -040034
35# output status of exercise run
36echo =========================
37echo =========================
38for script in $skips ; do
39 echo SKIP $script
40done
41for script in $passes ; do
42 echo PASS $script
43done
44for script in $failures ; do
45 echo FAILED $script
46done