2012-12-11 14:17:04 +00:00
|
|
|
# This script invokes the keytest.py script with the simple set-up needed
|
|
|
|
# to re-run deterministic regression tests that one would like to have.
|
|
|
|
#
|
|
|
|
# AUTOTEST_ROOT = ${LYX_ROOT}/development/autotests
|
|
|
|
# KEYTEST_INFILE = xxx-in.txt
|
|
|
|
# KEYTEST_OUTFILE = xxx-out.txt
|
|
|
|
# BINDIR = ${BUILD_DIR}/bin
|
|
|
|
# WORKDIR = ${BUILD_DIR}/autotests/out-home
|
2013-08-21 11:34:26 +00:00
|
|
|
# LYX_USERDIR_VER = ${LYX_USERDIR_VER}
|
2012-12-12 13:54:38 +00:00
|
|
|
# LOCALE_DIR = ${BUILD_DIR}/autotests/locale
|
|
|
|
# PO_BUILD_DIR = ${BUILD_DIR}/po
|
|
|
|
# PACKAGE = lyx2.1
|
2012-12-11 14:17:04 +00:00
|
|
|
#
|
|
|
|
# Script should be called like:
|
|
|
|
# cmake -DAUTOTEST_ROOT=xxxx \
|
2013-08-25 09:41:10 +00:00
|
|
|
# -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
|
2012-12-11 14:17:04 +00:00
|
|
|
# -DKEYTEST_INFILE=xxxx \
|
|
|
|
# -DKEYTEST_OUTFILE=xxx \
|
|
|
|
# -DBINDIR=xxx \
|
2013-01-05 09:07:37 +00:00
|
|
|
# -DLYX=xxx \
|
2012-12-12 13:54:38 +00:00
|
|
|
# -DWORKDIR=xxx \
|
2013-08-21 11:34:26 +00:00
|
|
|
# -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
|
2012-12-12 13:54:38 +00:00
|
|
|
# -DLOCALE_DIR=xxx \
|
|
|
|
# -DPO_BUILD_DIR=xxx \
|
|
|
|
# -DPACKAGE=xxx \
|
2012-12-11 14:17:04 +00:00
|
|
|
# -P ${AUTOTEST_ROOT}/single-test.cmake
|
|
|
|
|
|
|
|
set(KEYTEST "${AUTOTEST_ROOT}/keytest.py")
|
|
|
|
|
2013-01-05 09:07:37 +00:00
|
|
|
execute_process(COMMAND pidof ${LYX} OUTPUT_VARIABLE LYX_PID RESULT_VARIABLE pidstat OUTPUT_VARIABLE pidres)
|
2012-12-11 14:17:04 +00:00
|
|
|
message(STATUS "pidres = ${pidres}")
|
|
|
|
if (NOT pidstat)
|
|
|
|
# lyx already running, remove trailing '\n' from pid
|
|
|
|
string(REGEX REPLACE "\n" "" pidres ${pidres})
|
|
|
|
execute_process(COMMAND wmctrl -l -p OUTPUT_VARIABLE _wmco)
|
|
|
|
string(REGEX REPLACE "[\n]+" ";" _wmc ${_wmco})
|
|
|
|
foreach(_w ${_wmc})
|
|
|
|
string(REGEX MATCH "${pidres}" _wr ${_w})
|
|
|
|
if (${_wr} MATCHES ${pidres})
|
|
|
|
# this entry contains the pid, go search for X11-window-id
|
|
|
|
string(REGEX REPLACE " .*" "" _wr ${_w})
|
|
|
|
set(LYX_WINDOW_NAME ${_wr})
|
|
|
|
message(STATUS "Set LYX_WINDOW_NAME to ${_wr}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
set(pidres "")
|
|
|
|
set(LYX_WINDOW_NAME "")
|
|
|
|
endif()
|
|
|
|
|
2014-08-25 11:45:32 +00:00
|
|
|
#check for plausible DISPLAY environment (needed bei keytests)
|
|
|
|
set(DISPLAY_VAR $ENV{DISPLAY})
|
|
|
|
if(NOT DISPLAY_VAR MATCHES "^[a-zA-Z\\.]*:[0-9]+\(\\.[0-9]+\)?$")
|
|
|
|
message(FATAL_ERROR "Invalid DISPLAY environment value (== '${DISPLAY_VAR}')")
|
|
|
|
endif()
|
|
|
|
|
2013-01-05 09:07:37 +00:00
|
|
|
set(LYX_EXE "${BINDIR}/${LYX}")
|
2013-08-21 11:34:26 +00:00
|
|
|
set(use_hacked $ENV{XVKBD_HACKED})
|
|
|
|
if(NOT use_hacked)
|
|
|
|
if(use_hacked STREQUAL "")
|
|
|
|
# ENV{XVKBD_HACKED} probably not set, so the default should be
|
|
|
|
# to use the hacked
|
|
|
|
set(use_hacked "1")
|
|
|
|
else()
|
|
|
|
set(use_hacked "0")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(use_hacked "1")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ENV{XVKBD_HACKED} ${use_hacked})
|
|
|
|
if(use_hacked)
|
|
|
|
set(XVKBD_EXE "${BINDIR}/xvkbd")
|
|
|
|
else()
|
|
|
|
set(XVKBD_EXE "/usr/bin/xvkbd")
|
|
|
|
endif()
|
2012-12-11 14:17:04 +00:00
|
|
|
|
2013-08-25 09:41:10 +00:00
|
|
|
if(EXISTS "${LYX_TESTS_USERDIR}/session")
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${LYX_TESTS_USERDIR}/session")
|
2013-01-25 09:47:31 +00:00
|
|
|
endif()
|
2012-12-11 14:17:04 +00:00
|
|
|
# Environments needed by keytest.py
|
2012-12-12 13:54:38 +00:00
|
|
|
set(ENV{PACKAGE} ${PACKAGE})
|
|
|
|
set(ENV{LOCALE_DIR} ${LOCALE_DIR})
|
2013-09-07 06:58:21 +00:00
|
|
|
set(ENV{LYX_LOCALEDIR} "${LOCALE_DIR}")
|
2013-08-25 09:41:10 +00:00
|
|
|
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
|
2012-12-11 14:17:04 +00:00
|
|
|
set(ENV{LYX_PID} ${pidres})
|
|
|
|
set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
|
|
|
|
set(ENV{LYX_EXE} ${LYX_EXE})
|
2013-01-05 09:07:37 +00:00
|
|
|
set(ENV{LYX} ${LYX})
|
2012-12-11 14:17:04 +00:00
|
|
|
set(ENV{XVKBD_EXE} ${XVKBD_EXE})
|
|
|
|
set(ENV{KEYTEST_INFILE} "${AUTOTEST_ROOT}/${KEYTEST_INFILE}")
|
|
|
|
set(ENV{KEYTEST_OUTFILE} "${WORKDIR}/${KEYTEST_OUTFILE}")
|
2012-12-12 13:54:38 +00:00
|
|
|
set(ENV{PO_BUILD_DIR} "${PO_BUILD_DIR}")
|
2012-12-13 11:38:38 +00:00
|
|
|
set(ENV{MAX_DROP} 0)
|
2012-12-15 11:58:31 +00:00
|
|
|
set(ENV{MAX_LOOPS} 1)
|
2013-01-27 11:21:18 +00:00
|
|
|
string(REGEX REPLACE "-in\\.(txt|sh)$" "" _jj ${KEYTEST_INFILE})
|
|
|
|
if(EXISTS "${WORKDIR}/../${_jj}.lyx.emergency")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove -f "${WORKDIR}/../${_jj}.lyx.emergency" )
|
|
|
|
endif()
|
2012-12-11 17:59:05 +00:00
|
|
|
file(GLOB _testfiles RELATIVE "${WORKDIR}" "test*.*" "#test*.*")
|
2012-12-11 14:17:04 +00:00
|
|
|
if(_testfiles)
|
|
|
|
# remove some leftover files from previous test
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove -f ${_testfiles} )
|
|
|
|
endif()
|
2013-01-27 10:29:50 +00:00
|
|
|
if(EXISTS "${AUTOTEST_ROOT}/${_jj}.lyx")
|
|
|
|
configure_file("${AUTOTEST_ROOT}/${_jj}.lyx" "${WORKDIR}/../${_jj}.lyx" COPYONLY)
|
|
|
|
endif()
|
2012-12-11 14:17:04 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND python ${KEYTEST}
|
|
|
|
RESULT_VARIABLE KEYTEST_RES)
|
|
|
|
if(KEYTEST_RES)
|
|
|
|
message(FATAL_ERROR "KEYTEST failed: KEYTEST_RES=${KEYTEST_RES}")
|
|
|
|
endif()
|
|
|
|
|