On 11/12/12 11:36, Kornel Benko wrote: > Hi, > > I am trying to make autotests run under cmake. So far I made some progress.
Hi, good to hear. As a start, do you know whether invoking these tests by the normal: ./run-tests.sh findadv-06-in.txt works ? Also, please, check the README file in autotests/, it should explain that you need some dependencies. Also, feel free to propose integrations to the description. > 1.) I could not find the place where the lyx (in automake) is started. This > is needed, > > since the call to `pidof lyx` cannot work. I start lyx now manually before > the tests ... Please, detail what the problem is. In run-tests.sh, there is: export LYX_ROOT=../../.. export LYX_EXE=$LYX_ROOT/src/lyx and it should find everything, assuming you launch these tests from within the autotests/ dir. Here, a pitfall may be that one DOES NOT NEED ANY RUNNING LYX INSTANCE (i.e., writing serious papers with LyX while testing LyX-git ?!?!? ... bad idea), but it's not documented. The Makefile is actually a shorthand for launching all the available tests, it doesn't really do any complex stuff, just compiles the custom xvkbd if needed. All the issues below seem strange, as these tests are currently working on my laptop. However, I'm sure there's a lot of stale code and there's a need for clean-up (and some tests just work by miracle, and I can remember somebody with slow WM or 3D effects or smth. else having problems in launching even the simplest of these tests). > 2.) The syntax of "wctrl" changed. > > 2a.) I have to use > > "wctrl -i -a xxxx" > > instead of "wctrl -a xxxx", because otherwise the xxx is interpreted as NAME > of the window Yes, seems needed. Likely it was working as I usually I launch the tests and don't touch anything. But, if you have a focus-on-mouse or other WM, or options to spawn the LyX window on different screen/monitor, who knows what can happen...? > 2b.) For searching the window-id with known pid I had to use > > "wctrl -l -p" > > instead of "wmctrl -l", because otherwise there was no pid in the output This was already ok in the *.py, but not in the *.sh. Surely needed. > 3.) Installation of missing "pcregrep" mentioned in the README. > 4.) Setting preferences to use English for the lyx-gui while testing Hmmm..., actually, most tests set and require it_IT, as I wrote them with my prior installation, that was localized in IT. Recently, I committed a patch that correctly sets LANGUAGE in addition to LANG, and recovered the correct language setting (you should see Italian menus showing up in all -- or most of -- the tests). > Now the tests > > first-time-in.txt, findadv-0[1-5]-in.txt > > are OK. Problems are with findadv-06-in.txt > > I am attaching the log-files, maybe someone can see, what’s wrong. Before checking, can u pls confirm the GUI shows up in Italian ? FYI, it is possible to write tests in any other language, it's just a Lang directive in the tests files: Lang it_IT.utf8 which is actually executed as mangling with directories, e.g. autotests$ find locale/ locale/ locale/it_IT locale/it_IT/LC_MESSAGES locale/it_IT/LC_MESSAGES/lyx-trunk.mo locale/en_US locale/en_US/LC_MESSAGES locale/en_US/LC_MESSAGES/lyx-trunk.mo and a symlink $ ls ../../locale -l lrwxrwxrwx 1 tommaso tommaso 59 Sep 7 00:16 ../../locale -> /home/tommaso/lyx-trunk-ws/lyx/development/autotests/locale that, after help from devel list, I discovered to be the working receipt for having (the not installed) LyX starting in a language different than the default. > (E.g. why are we expecting 'Putting selection at .*idx: 0 par: 2 pos: 0\n > with len: 3' twice, and why is this string only once in log) Well, check well: TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 [...] KK: foo\[Return] TestEnd Assert pcregrep -M 'Putting selection at .*idx: 0 par: 1 pos: 0\n with len: 3' lyx-log.txt # TestBegin test.lyx -dbg find > lyx-log2.txt 2>&1 [...] KK: foo\[Return]\[Return] TestEnd Assert pcregrep -M 'Putting selection at .*idx: 0 par: 2 pos: 0\n with len: 3' lyx-log2.txt First test searches once, second test searches twice (double \[Return]), thus it expects the match at the 2nd paragraph (par: 2), not the first (par: 1), as the first test. > There is also lyx-log.txt, I can attach it too, but it is somewhat lenghty > (8644 bytes) And, you should have a lyx-log2.txt as well, showing the 2 "putting selection at". Logs are kept separate so one can see both (and compare), if needed. So, I came across the attached patch so far, which still gives me a working set of tests. If that's useful for you, I'll push it. Also, you might have further stuff to push yourself here. If you instruct me in how to use cmake (never ever tried), then I can help testing the cmake machinery as well. T.
diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py index 76492a3..fcbdde1 100755 --- a/development/autotests/keytest.py +++ b/development/autotests/keytest.py @@ -234,7 +234,7 @@ def RaiseWindow(): #intr_system("echo x-session-manager open files: `lsof -p $X_PID | grep ICE-unix | wc -l`") ####intr_system("wmctrl -l | ( grep '"+lyx_window_name+"' || ( killall lyx ; sleep 1 ; killall -9 lyx ))") #intr_system("wmctrl -R '"+lyx_window_name+"' ;sleep 0.1") - system_retry(30, "wmctrl -a '"+lyx_window_name+"'") + system_retry(30, "wmctrl -i -a '"+lyx_window_name+"'") lyx_pid = os.environ.get('LYX_PID') diff --git a/development/autotests/single-test.sh b/development/autotests/single-test.sh index d5bdd87..72b8eeb 100755 --- a/development/autotests/single-test.sh +++ b/development/autotests/single-test.sh @@ -18,7 +18,7 @@ fi export MAX_DROP=0 if [ "$(pidof lyx)" != "" ]; then export LYX_PID=$(pidof lyx) - export LYX_WINDOW_NAME=$(wmctrl -l | grep " $LYX_PID " | cut -d ' ' -f 1); + export LYX_WINDOW_NAME=$(wmctrl -l -p | grep " $LYX_PID " | cut -d ' ' -f 1); fi export MAX_LOOPS=1 export LYX_EXE=${LYX_EXE:-../../src/lyx}