X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=development%2Fautotests%2Frun-tests.sh;h=a3f7d12eb4cfae8103269bec328707f7f067be82;hb=f08f5821ec5d29232bccb342a5b1ff86600b0716;hp=80201083a102f9f0dfa79cad25dd82ad3c04bf4c;hpb=b66dcc5536ee7993ee3badb0b464870e9c71446a;p=lyx.git diff --git a/development/autotests/run-tests.sh b/development/autotests/run-tests.sh index 80201083a1..a3f7d12eb4 100755 --- a/development/autotests/run-tests.sh +++ b/development/autotests/run-tests.sh @@ -4,7 +4,8 @@ # Tests are identified as having a file name of *-in.txt # For failed tests, the collected output is kept in the corresponding folder -export LYX_EXE=../../../src/lyx +export LYX_ROOT=../../.. +export LYX_EXE=$LYX_ROOT/src/lyx if [ "$XVKBD_HACKED" != "" ]; then export XVKBD_EXE=${XVKBD:-./xvkbd/xvkbd}; @@ -14,6 +15,12 @@ if [ "$XVKBD_HACKED" != "" ]; then fi fi +if [ "$(which wmctrl)" == "" ]; then + echo "You need to install wmctrl first, try:" + echo " sudo apt-get install wmctrl" + exit -1; +fi + export XVKBD_EXE=../$XVKBD_EXE export KEYTEST=../keytest.py LYX_HOME=out-home @@ -38,7 +45,7 @@ if [ ! -d ../../locale ]; then fi if [ "$#" -eq 0 ]; then - TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//') + TESTS=$(ls *-in.txt *-in.sh | sed -e 's/hello-world-in.txt\|first-time-in.txt//') rm -rf out-*; else TESTS=$* @@ -52,7 +59,7 @@ if [ ! -d $LYX_HOME ]; then # cp preferences $LYX_USERDIR cd $LYX_HOME echo "Initializing testing environment . . ." - if ! ../single-test.sh "../first-time-in.txt" > keytest-log.txt 2>&1; then + if ! ../single-test.sh "../first-time-in.txt" > test-log.txt 2>&1; then echo "Some error occurred: check $(pwd)" exit -1; fi @@ -63,21 +70,37 @@ fi ./stop_autotests.tcl & pid=$! +function stop_button() { + kill $pid + wait $pid > /dev/null 2>&1 +} + 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" +for tf in $(echo "$TESTS"); do + t=$(echo $tf | sed -e 's/-in.txt//g' | sed -e 's/-in.sh//g') + printf "%40s: " $tf + if [ -f "$t-in.txt" ]; then + cmd="../single-test.sh ../$t-in.txt"; + elif [ -f "$t-in.sh" ]; then + if [ ! -x "$t-in.sh" ]; then + echo "ERROR: $t-in.sh is not executable" + stop_button + exit -1; + fi + cmd="../$tf"; + else + echo "ERROR: File not found: $t-in.txt or $t-in.sh" + stop_button 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 + if $cmd > test-log.txt 2>&1; then echo Ok cd .. - rm -rf "out-$t"; + if [ "$V" != "" ]; then rm -rf "out-$t"; fi else echo FAILED cd .. @@ -85,8 +108,7 @@ for t in $(echo "$TESTS" | sed -e 's/-in.txt//g'); do fi; done -kill $pid -wait $pid > /dev/null 2>&1 +stop_button echo if [ $failed -eq 0 ]; then