]> git.lyx.org Git - lyx.git/blob - development/autotests/export.cmake
Add forgotten files
[lyx.git] / development / autotests / export.cmake
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2012 Kornel Benko kornel@lyx.org
5 #
6 #
7 # LYX_ROOT  = ${TOP_SRC_DIR}/lib/doc
8 # lyx       = 
9 # format    = lyx16x|xhtml
10 # extension = 16.lyx|xhtml
11 # file      = xxx
12 #
13 # Script should be called like:
14 # cmake -DLYX_ROOT=xxx \
15 #       -Dlyx=xxx \
16 #       -Dformat=xxx \
17 #       -Dextension=xxx \
18 #       -Dfile=xxx \
19 #       -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
20 #
21
22 message(STATUS "Executing ${lyx} -E ${format} ${file}.${extension} ${LYX_ROOT}/${file}.lyx")
23 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
24 execute_process(
25   COMMAND ${lyx} -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"
26   RESULT_VARIABLE _err)
27 string(COMPARE NOTEQUAL  ${_err} 0 _erg)
28 if(_erg)
29   message(STATUS "Exporting ${f}.lyx to ${format}")
30   message(FATAL_ERROR "Export failed")
31 endif()
32 # This script invokes the keytest.py script with the simple set-up needed
33 # to re-run deterministic regression tests that one would like to have.
34 #
35 # AUTOTEST_ROOT   = ${LYX_ROOT}/development/autotests
36 # KEYTEST_INFILE  = xxx-in.txt
37 # KEYTEST_OUTFILE = xxx-out.txt
38 # BINDIR          = ${BUILD_DIR}/bin
39 # WORKDIR         = ${BUILD_DIR}/autotests/out-home
40 # LOCALE_DIR      = ${BUILD_DIR}/autotests/locale
41 # PO_BUILD_DIR    = ${BUILD_DIR}/po
42 # PACKAGE         = lyx2.1
43 #
44 # Script should be called like:
45 # cmake -DAUTOTEST_ROOT=xxxx \
46 #       -DKEYTEST_INFILE=xxxx \
47 #       -DKEYTEST_OUTFILE=xxx \
48 #       -DBINDIR=xxx \
49 #       -DWORKDIR=xxx \
50 #       -DLOCALE_DIR=xxx \
51 #       -DPO_BUILD_DIR=xxx \
52 #       -DPACKAGE=xxx \
53 #       -P ${AUTOTEST_ROOT}/single-test.cmake
54
55 set(KEYTEST "${AUTOTEST_ROOT}/keytest.py")
56
57 execute_process(COMMAND pidof lyx OUTPUT_VARIABLE LYX_PID RESULT_VARIABLE pidstat OUTPUT_VARIABLE pidres)
58 message(STATUS "pidres = ${pidres}")
59 if (NOT pidstat)
60   # lyx already running, remove trailing '\n' from pid
61   string(REGEX REPLACE "\n" "" pidres ${pidres})
62   execute_process(COMMAND wmctrl -l -p OUTPUT_VARIABLE _wmco)
63   string(REGEX REPLACE "[\n]+" ";" _wmc ${_wmco})
64   foreach(_w ${_wmc})
65     string(REGEX MATCH "${pidres}" _wr ${_w})
66     if (${_wr} MATCHES ${pidres})
67       # this entry contains the pid, go search for X11-window-id
68       string(REGEX REPLACE " .*" "" _wr ${_w})
69       set(LYX_WINDOW_NAME ${_wr})
70       message(STATUS "Set LYX_WINDOW_NAME to ${_wr}")
71     endif()
72   endforeach()
73 else()
74   set(pidres "")
75   set(LYX_WINDOW_NAME "")
76 endif()