#!/bin/sh

# This script executes each of the Qt tests and concatenates the results
# in one file called "journal.qt"

rm -f ./journal.qt

for testDir in tests/q*; do

    pushd . >/dev/null
    cd $testDir

    basetestname=`basename $testDir`
    if [ ! -x "tst_$basetestname" ]; then
        echo "Unable to find test binary tst_$basetestname in $testDir"
        exit 1
    fi
 
    ./tst_$basetestname
 
    popd >/dev/null

    journal=$testDir/journal.tst_$basetestname
    if [ ! -e "$journal" ]; then
        echo "Unable to find journal file $journal"
        exit 1
    fi

    cat $journal >>./journal.qt
    rm $journal
done

