#!/bin/bash set -e DIR="$(dirname "$0")" COMPILER="$(dirname "$DIR")/compile.sh" # just call abort on error TEMPOUT="$(mktemp)" abort () { rm "$tempout" echo "Test aborted" exit 1 } # run all shell files in this directory for SH in "$DIR/test_"*.sh; do "$SH" || abort done # run all cpp files in this directory for CPP in "$DIR/test_"*.cpp; do # compile the test "$COMPILER" "$CPP" -o "$TEMPOUT" || abort # run the test chmod +x "$TEMPOUT" "$TEMPOUT" done