#!/bin/sh -e
#
# Run the test suite to check if the installation was OK

# Make sure strings and dates have predictable format
LC_ALL=C

basedir=/usr/lib/debian-edu-config/testsuite

cd $basedir

printmsg() {
    msg="$1"
    if [ "$debian_edu_error_flag_file" ] ; then 
        echo "$@" >> $debian_edu_error_flag_file
    else
        echo "$@" 1>&2
    fi
}

for file in *; do
    TEST=$(basename $file)
    start=$(date +%s)
    if ! ./$file ; then 
	printmsg "$0: $TEST failed"
    fi
    end=$(date +%s)
    duration=$(( $end - $start ))
    printmsg "info: duration $duration seconds for testsuite/$TEST"
done
