lyx_mirror/development/autotests/run-tests.sh
Tommaso Cucinotta 3596e02d6a Suppress killall output when killing STOP button.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37560 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-08 00:14:23 +00:00

76 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# This script runs all the test scripts it finds in the current folder
# Tests are identified as having a file name of *-in.txt
# For failed tests, the collected output is kept in the corresponding folder
if [ ! -x xvkbd/xvkbd ]; then
echo "You need to build XVKBD first, try: cd xvkbd && xmkmf && make"
exit -1;
fi
export LYX_EXE=../../../src/lyx
if [ "$XVKBD_HACKED" != "" ]; then
export XVKBD_EXE=${XVKBD:-../xvkbd/xvkbd};
fi
export KEYTEST=../keytest.py
LYX_HOME=out-home
export LYX_USERDIR=$(pwd)/$LYX_HOME/.lyx
if [ "$#" -eq 0 ]; then
TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//');
else
TESTS=$*
fi
echo
if [ ! -d $LYX_HOME ]; then
mkdir $LYX_HOME
cd $LYX_HOME
echo "Initializing testing environment . . ."
if ! ../single-test.sh "../first-time-in.txt" > keytest-log.txt 2>&1; then
echo "Some error occurred: check $(pwd)"
exit -1;
fi
cd ..
fi
# Launch the emergency STOP button
./stop_autotests.tcl &
echo "Running test cases . . ."
failed=0
for t in $(echo "$TESTS" | sed -e 's/-in.txt//g'); do
printf "%40s: " $t
if [ ! -f "$t-in.txt" ]; then
echo "ERROR: File not found: $t-in.txt"
exit -1;
fi
rm -rf "out-$t"
mkdir "out-$t"
cd "out-$t"
if ../single-test.sh "../$t-in.txt" > keytest-log.txt 2>&1; then
echo Ok
cd ..
rm -rf "out-$t";
else
echo FAILED
cd ..
failed=$[$failed+1];
fi;
done
killall stop_autotests.tcl > /dev/null 2>&1
echo
if [ $failed -eq 0 ]; then
echo "All tests SUCCESSFUL"
else
echo "There were $failed FAILED tests";
fi
echo