2011-11-04 14:31:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2011-11-10 23:11:28 +00:00
|
|
|
source ./stackrc
|
2011-11-04 14:31:37 +00:00
|
|
|
# Run everything in the exercises/ directory that isn't explicitly disabled
|
|
|
|
|
|
|
|
# comma separated list of script basenames to skip
|
|
|
|
# to refrain from exercising euca.sh use SKIP_EXERCISES=euca
|
|
|
|
SKIP_EXERCISES=${SKIP_EXERCISES:-""}
|
|
|
|
|
2011-11-04 16:09:54 +00:00
|
|
|
# Locate the scripts we should run
|
2011-11-04 14:31:37 +00:00
|
|
|
EXERCISE_DIR=$(dirname "$0")/exercises
|
2011-11-05 14:46:56 +00:00
|
|
|
basenames=$(for b in `ls $EXERCISE_DIR/*.sh`; do basename $b .sh; done)
|
2011-11-04 14:31:37 +00:00
|
|
|
|
2011-11-04 16:09:54 +00:00
|
|
|
# Track the state of each script
|
|
|
|
passes=""
|
|
|
|
failures=""
|
|
|
|
skips=""
|
|
|
|
|
|
|
|
# Loop over each possible script (by basename)
|
2011-11-05 14:46:56 +00:00
|
|
|
for script in $basenames; do
|
2011-11-04 14:31:37 +00:00
|
|
|
if [[ "$SKIP_EXERCISES" =~ $script ]] ; then
|
2011-11-04 16:09:54 +00:00
|
|
|
skips="$skips $script"
|
2011-11-04 14:31:37 +00:00
|
|
|
else
|
2011-11-04 16:09:54 +00:00
|
|
|
echo =========================
|
2011-11-04 14:31:37 +00:00
|
|
|
echo Running $script
|
2011-11-04 16:09:54 +00:00
|
|
|
echo =========================
|
|
|
|
$EXERCISE_DIR/$script.sh
|
2011-11-04 14:31:37 +00:00
|
|
|
if [[ $? -ne 0 ]] ; then
|
2011-11-04 16:09:54 +00:00
|
|
|
failures="$failures $script"
|
2011-11-04 14:31:37 +00:00
|
|
|
else
|
2011-11-04 16:09:54 +00:00
|
|
|
passes="$passes $script"
|
2011-11-04 14:31:37 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2011-11-04 16:09:54 +00:00
|
|
|
|
|
|
|
# output status of exercise run
|
|
|
|
echo =========================
|
|
|
|
echo =========================
|
2011-11-05 14:46:56 +00:00
|
|
|
for script in $skips; do
|
2011-11-04 16:09:54 +00:00
|
|
|
echo SKIP $script
|
|
|
|
done
|
2011-11-05 14:46:56 +00:00
|
|
|
for script in $passes; do
|
2011-11-04 16:09:54 +00:00
|
|
|
echo PASS $script
|
|
|
|
done
|
2011-11-05 14:46:56 +00:00
|
|
|
for script in $failures; do
|
2011-11-04 16:09:54 +00:00
|
|
|
echo FAILED $script
|
|
|
|
done
|
2011-11-10 23:11:28 +00:00
|
|
|
|
|
|
|
if [ -n "$failures" ] ; then
|
|
|
|
exit 1
|
|
|
|
fi
|