Cmake build: modify some tests

a) test export/templates/ectaart_pdf5 removed, because
    of incompatibility between ectart.cls and luatex.sty
b) renamed some tests to reflect their purpose
    tex2lyx2lyx/roundtrip/ => tex2lyx/cmplyx/
          # the tests are comparing files written by lyx (not by tex2lyx)
    autotests/ => keytest/
          # we are testing reactions of lyx to some key strokes
c) add tests for lyx2lyx. This is rather rudimental, in that it only
    checks for created output, error codes and error output.
d) use correct environment variable to set up the userdir for testing
This commit is contained in:
Kornel Benko 2013-08-21 13:34:26 +02:00
parent 78b4c3f80f
commit fc33092fd8
5 changed files with 90 additions and 12 deletions

View File

@ -60,11 +60,11 @@ if(Q_WS_X11)
if(Missing)
message(STATUS "Missing Libraries or programs to create xvkbd: ${Missing}")
message(STATUS "cmake build is therefore omitting autotests")
message(STATUS "cmake build is therefore omitting keytests")
endif()
if(NOT Missing)
project(autotests)
project(keytest)
add_subdirectory(xvkbd)
@ -80,7 +80,7 @@ if(Q_WS_X11)
foreach(_tf first-time-in.txt hello-world-in.txt ${TESTST})
string(REGEX REPLACE "-in\\.(txt|sh)" "" _t ${_tf})
add_test(NAME autotests/${_t}
add_test(NAME keytest/${_t}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND}
-DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
@ -89,6 +89,7 @@ if(Q_WS_X11)
-DBINDIR=$<TARGET_FILE_DIR:${_lyx}>
-DLYX=${_lyx}
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-DLYX_USERDIR_VER=${LYX_USERDIR_VER}
-DKEYTEST_OUTFILE=${_t}-out.txt
-DPACKAGE=${PACKAGE}
-DLOCALE_DIR=${LOCALE_DIR}
@ -142,6 +143,7 @@ foreach(libsubfolder doc examples templates)
endif()
endforeach()
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/revertedTests" revertedTests)
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/ignoredTests" ignoredTests)
foreach(f ${nolang_lyx_files} ${lang_lyx_files})
# Strip extension
string(REGEX REPLACE "\\.lyx$" "" f ${f})
@ -152,14 +154,24 @@ foreach(libsubfolder doc examples templates)
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
-Dlyx=$<TARGET_FILE:${_lyx}>
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-DLYX_USERDIR_VER=${LYX_USERDIR_VER}
-Dformat=lyx16x
-Dextension=16.lyx
-Dfile=${f}
-Dreverted=${reverted}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
set(TestName "lyx2lyx/${libsubfolder}/${f}")
getreverted(TestName reverted revertedTests)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX2LYX=${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
foreach(format ${formatlist})
set(TestName "export/${libsubfolder}/${f}_${format}")
list(FIND ignoredTests ${TestName} _idx)
if (${_idx} LESS 0)
getreverted(TestName reverted revertedTests)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
@ -171,6 +183,7 @@ foreach(libsubfolder doc examples templates)
-Dfile=${f}
-Dreverted=${reverted}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
endif()
endforeach()
endforeach()
endforeach()

View File

@ -5,6 +5,7 @@
#
#
# LYX_ROOT = ${TOP_SRC_DIR}/lib/{doc,examples,templates}
# LYX_USERDIR_VER = Name of environment variable for the user directory
# lyx =
# format = lyx16x|xhtml
# extension = 16.lyx|xhtml
@ -12,7 +13,8 @@
#
# Script should be called like:
# cmake -DLYX_ROOT=xxx \
# -DWORKDIR=${BUILD_DIR}/autotests/out-home
# -DWORKDIR=${BUILD_DIR}/autotests/out-home \
# -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
# -Dlyx=xxx \
# -Dformat=xxx \
# -Dextension=xxx \
@ -22,7 +24,7 @@
#
message(STATUS "Executing ${lyx} -E ${format} ${file}.${extension} ${LYX_ROOT}/${file}.lyx")
set(ENV{LYX_USERDIR} "${WORKDIR}/.lyx")
set(ENV{${LYX_USERDIR_VER}} "${WORKDIR}/.lyx")
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
execute_process(
COMMAND ${lyx} -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"

View File

@ -0,0 +1 @@
export/templates/ectaart_pdf5

View File

@ -0,0 +1,43 @@
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
#
# Copyright (c) 2013 Kornel Benko kornel@lyx.org
#
#
# LYX2LYX = ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
# LYXFILE = xxx
#
# Script should be called like:
# cmake -DLYX2LYX=xxx \
# -DWORKDIR=${BUILD_DIR}/autotests/out-home \
# -DLYXFILE=xxx \
# -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
#
message(STATUS "Executing ${LYX2LYX} -e errors -o output ${LYXFILE}")
execute_process(
COMMAND ${LYX2LYX} -e errors -o output ${LYXFILE}
RESULT_VARIABLE _err)
message(STATUS "Error output of lyx2lyx = ${_err}")
string(COMPARE NOTEQUAL ${_err} 0 _erg)
# Check file "errors" being empty
file(STRINGS "errors" foundErrors)
if(foundErrors)
set(_erg 1)
foreach(_l ${foundErrors})
message(STATUS "${_l}")
endforeach()
endif()
# Check file "output" being not empty
file(STRINGS "output" createdLyx)
if(NOT createdLyx)
set(_erg 1)
message(STATUS "Created file empty")
endif()
if(_erg)
message(FATAL_ERROR "lyx2lyx failed")
endif()

View File

@ -6,6 +6,7 @@
# KEYTEST_OUTFILE = xxx-out.txt
# BINDIR = ${BUILD_DIR}/bin
# WORKDIR = ${BUILD_DIR}/autotests/out-home
# LYX_USERDIR_VER = ${LYX_USERDIR_VER}
# LOCALE_DIR = ${BUILD_DIR}/autotests/locale
# PO_BUILD_DIR = ${BUILD_DIR}/po
# PACKAGE = lyx2.1
@ -17,6 +18,7 @@
# -DBINDIR=xxx \
# -DLYX=xxx \
# -DWORKDIR=xxx \
# -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
# -DLOCALE_DIR=xxx \
# -DPO_BUILD_DIR=xxx \
# -DPACKAGE=xxx \
@ -46,8 +48,25 @@ else()
endif()
set(LYX_EXE "${BINDIR}/${LYX}")
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")
set(ENV{XVKBD_HACKED} "1")
else()
set(XVKBD_EXE "/usr/bin/xvkbd")
endif()
if(EXISTS "${WORKDIR}/.lyx/session")
execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${WORKDIR}/.lyx/session")
@ -56,7 +75,7 @@ endif()
set(ENV{PACKAGE} ${PACKAGE})
set(ENV{LOCALE_DIR} ${LOCALE_DIR})
set(ENV{LYX_LOCALEDIR} "${WORKDIR}/../locale")
set(ENV{LYX_USERDIR} "${WORKDIR}/.lyx")
set(ENV{${LYX_USERDIR_VER}} "${WORKDIR}/.lyx")
set(ENV{LYX_PID} ${pidres})
set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
set(ENV{LYX_EXE} ${LYX_EXE})