]> git.lyx.org Git - features.git/blob - development/autotests/run-tests.sh
Added emergency STOP button in tcl/tk window for immediate & painless termination...
[features.git] / development / autotests / run-tests.sh
1 #!/bin/bash
2
3 # This script runs all the test scripts it finds in the current folder
4 # Tests are identified as having a file name of *-in.txt
5 # For failed tests, the collected output is kept in the corresponding folder
6
7 if [ ! -x xvkbd/xvkbd ]; then
8     echo "You need to build XVKBD first, try: cd xvkbd && xmkmf && make"
9     exit -1;
10 fi
11
12 export LYX_EXE=../../../src/lyx
13
14 if [ "$XVKBD_HACKED" != "" ]; then
15     export XVKBD_EXE=${XVKBD:-../xvkbd/xvkbd};
16 fi
17
18 export KEYTEST=../keytest.py
19 LYX_HOME=out-home
20 export LYX_USERDIR=$(pwd)/$LYX_HOME/.lyx
21
22 if [ "$#" -eq 0 ]; then
23     TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//');
24 else
25     TESTS=$*
26 fi
27
28 echo
29
30 if [ ! -d $LYX_HOME ]; then
31     mkdir $LYX_HOME
32     cd $LYX_HOME
33     echo "Initializing testing environment . . ."
34     if ! ../single-test.sh "../first-time-in.txt" > keytest-log.txt 2>&1; then
35         echo "Some error occurred: check $(pwd)"
36         exit -1;
37     fi
38     cd ..
39 fi
40
41 # Launch the emergency STOP button
42 ./stop_autotests.tcl &
43
44 echo "Running test cases . . ."
45 failed=0
46 for t in $(echo "$TESTS" | sed -e 's/-in.txt//g'); do
47     printf "%40s: " $t
48     if [ ! -f "$t-in.txt" ]; then
49         echo "ERROR: File not found: $t-in.txt"
50         exit -1;
51     fi
52     rm -rf "out-$t"
53     mkdir "out-$t"
54     cd "out-$t"
55     if ../single-test.sh "../$t-in.txt" > keytest-log.txt 2>&1; then
56         echo Ok
57         cd ..
58         rm -rf "out-$t";
59     else
60         echo FAILED
61         cd ..
62         failed=$[$failed+1];
63     fi;
64 done
65
66 echo
67 if [ $failed -eq 0 ]; then
68     echo "All tests SUCCESSFUL"
69 else
70     echo "There were $failed FAILED tests";
71 fi
72
73 echo