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