2011-11-04 14:31:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# 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
|
|
|
|
basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done)
|
|
|
|
|
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-04 14:31:37 +00:00
|
|
|
for script in $basenames ; do
|
|
|
|
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 =========================
|
|
|
|
for script in $skips ; do
|
|
|
|
echo SKIP $script
|
|
|
|
done
|
|
|
|
for script in $passes ; do
|
|
|
|
echo PASS $script
|
|
|
|
done
|
|
|
|
for script in $failures ; do
|
|
|
|
echo FAILED $script
|
|
|
|
done
|