#!/bin/bash

LOGFILE="$ADTTMP/test.log"

# copy tests to temporary directory, as current one might be read-only
cp -a test "$ADTTMP"
cd "$ADTTMP/test"

# run tests
for dir in arguments environment fcopy filters fs profiles sysutils utils;
do
	pushd $dir
	bash -x ./$dir.sh | tee -a "$LOGFILE"
	popd
done

echo "======================================"
grep "TESTING" "$LOGFILE"
echo "======================================"

[ $(grep -c "TESTING ERROR" "$LOGFILE") -gt 0 ] && exit 1

exit 0
