From 705759d6783809031e1ee184827a23d146f8a433 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Tue, 1 Feb 2011 22:08:07 +0000 Subject: [PATCH] Added the creation of a custom .lyx folder inside `pwd`/home/.lyx at the beginning of the tests (which reconfigures LyX and takes some time), followed by all of the tests using it. This way, we get only the default configuration of LyX as a base, without being affected by individual users custom configurations. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37408 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/autotests/first-time-in.txt | 4 ++++ development/autotests/keytest.py | 8 ++++++-- development/autotests/run-tests.sh | 21 +++++++++++++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 development/autotests/first-time-in.txt diff --git a/development/autotests/first-time-in.txt b/development/autotests/first-time-in.txt new file mode 100644 index 0000000000..e5403854f8 --- /dev/null +++ b/development/autotests/first-time-in.txt @@ -0,0 +1,4 @@ +Lang en_US.utf8 +TestBegin test.lyx > lyx-log.txt 2>&1 +KK: \[Left]\[Return] +TestEnd diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py index ca475d756d..bb715ff0a7 100755 --- a/development/autotests/keytest.py +++ b/development/autotests/keytest.py @@ -234,6 +234,7 @@ outfilename = os.environ.get('KEYTEST_OUTFILE') max_drop = os.environ.get('MAX_DROP') lyx_window_name = os.environ.get('LYX_WINDOW_NAME') screenshot_out = os.environ.get('SCREENSHOT_OUT') +lyx_userdir = os.environ.get('LYX_USERDIR') max_loops = os.environ.get('MAX_LOOPS') if max_loops is None: @@ -299,10 +300,13 @@ while not failed: os.system("killall lyx") time.sleep(0.2) print "Starting LyX . . ." - os.system(lyx_exe + c[9:] + "&") + if lyx_userdir is None: + os.system(lyx_exe + c[9:] + "&") + else: + os.system(lyx_exe + " -userdir " + lyx_userdir + " " + c[9:] + "&") while True: lyx_pid=os.popen("pidof lyx").read().rstrip() - lyx_window_name=os.popen("wmctrl -l | grep 'lyx$\\|LyX:' | sed -e 's/.*\\([Ll]y[Xx].*\\)$/\\1/'").read().rstrip() + lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip() if lyx_window_name != "": break print 'lyx_win: ' + lyx_window_name + '\n' diff --git a/development/autotests/run-tests.sh b/development/autotests/run-tests.sh index ba4067d1f7..766f4c1a70 100755 --- a/development/autotests/run-tests.sh +++ b/development/autotests/run-tests.sh @@ -6,21 +6,38 @@ export LYX_EXE=../../../src/lyx export KEYTEST=../keytest.py +export LYX_USERDIR=$(pwd)/home/.lyx if [ "$#" -eq 0 ]; then - TESTS=$(ls *-in.txt); + TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//'); else TESTS=$* fi echo + +if [ ! -d home ]; then + mkdir home + cd 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 + 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" - printf "%40s: " $t if ../single-test.sh "../$t-in.txt" > keytest-log.txt 2>&1; then echo Ok cd ..