]> git.lyx.org Git - features.git/blob - development/autotests/run-tests.sh
Added custom xvkbd for avoiding typing into other windows.
[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 export XVKBD_EXE=../xvkbd/xvkbd
14 export KEYTEST=../keytest.py
15 LYX_HOME=out-home
16 export LYX_USERDIR=$(pwd)/$LYX_HOME/.lyx
17
18 if [ "$#" -eq 0 ]; then
19     TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//');
20 else
21     TESTS=$*
22 fi
23
24 echo
25
26 if [ ! -d $LYX_HOME ]; then
27     mkdir $LYX_HOME
28     cd $LYX_HOME
29     echo "Initializing testing environment . . ."
30     if ! ../single-test.sh "../first-time-in.txt" > keytest-log.txt 2>&1; then
31         echo "Some error occurred: check $(pwd)"
32         exit -1;
33     fi
34     cd ..
35 fi
36
37 echo "Running test cases . . ."
38 failed=0
39 for t in $(echo "$TESTS" | sed -e 's/-in.txt//g'); do
40     printf "%40s: " $t
41     if [ ! -f "$t-in.txt" ]; then
42         echo "ERROR: File not found: $t-in.txt"
43         exit -1;
44     fi
45     rm -rf "out-$t"
46     mkdir "out-$t"
47     cd "out-$t"
48     if ../single-test.sh "../$t-in.txt" > keytest-log.txt 2>&1; then
49         echo Ok
50         cd ..
51         rm -rf "out-$t";
52     else
53         echo FAILED
54         cd ..
55         failed=$[$failed+1];
56     fi;
57 done
58
59 echo
60 if [ $failed -eq 0 ]; then
61     echo "All tests SUCCESSFUL"
62 else
63     echo "There were $failed FAILED tests";
64 fi
65
66 echo