mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Cmake build autotests:
Split export test to test on each format and each input file One can still check all exports with one commend ctest -R "export.*"
This commit is contained in:
parent
0a2c70636a
commit
1f93b0805e
@ -13,7 +13,7 @@ if(Q_WS_X11)
|
|||||||
# while testing
|
# while testing
|
||||||
find_package(X11)
|
find_package(X11)
|
||||||
if(X11_FOUND AND PCREGREP_EXE AND WMCTRL_EXE)
|
if(X11_FOUND AND PCREGREP_EXE AND WMCTRL_EXE)
|
||||||
message(STATUS "PCREGREP_EXE and WMCTRL_EXE found")
|
#message(STATUS "PCREGREP_EXE and WMCTRL_EXE found")
|
||||||
project(autotests)
|
project(autotests)
|
||||||
|
|
||||||
add_subdirectory(xvkbd)
|
add_subdirectory(xvkbd)
|
||||||
@ -36,7 +36,7 @@ if(Q_WS_X11)
|
|||||||
-DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
|
-DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
|
||||||
-DPO_BUILD_DIR=${TOP_BINARY_DIR}/po
|
-DPO_BUILD_DIR=${TOP_BINARY_DIR}/po
|
||||||
-DKEYTEST_INFILE=${_tf}
|
-DKEYTEST_INFILE=${_tf}
|
||||||
-DBINDIR=${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}
|
-DBINDIR=$<TARGET_FILE_DIR:lyx>
|
||||||
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
|
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
|
||||||
-DKEYTEST_OUTFILE=${_t}-out.txt
|
-DKEYTEST_OUTFILE=${_t}-out.txt
|
||||||
-DPACKAGE=${PACKAGE}
|
-DPACKAGE=${PACKAGE}
|
||||||
@ -45,7 +45,27 @@ if(Q_WS_X11)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
add_test(NAME lyx_export
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
|
file(GLOB lyx_files RELATIVE "${TOP_SRC_DIR}/lib/doc" "${TOP_SRC_DIR}/lib/doc/*.lyx")
|
||||||
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${TOP_SRC_DIR} -Dlyx=${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/lyx -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
foreach(f ${lyx_files})
|
||||||
set_tests_properties(lyx_export PROPERTIES DEPENDS lyx)
|
# Strip extension
|
||||||
|
string(REGEX REPLACE "\\.lyx$" "" f ${f})
|
||||||
|
add_test(NAME export_${f}_lyx16
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${TOP_SRC_DIR}/lib/doc
|
||||||
|
-Dlyx=$<TARGET_FILE:lyx>
|
||||||
|
-Dformat=lyx16x
|
||||||
|
-Dextension=16.lyx
|
||||||
|
-Dfile=${f}
|
||||||
|
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
||||||
|
add_test(NAME export_${f}_xhtml
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${TOP_SRC_DIR}/lib/doc
|
||||||
|
-Dlyx=$<TARGET_FILE:lyx>
|
||||||
|
-Dformat=xhtml
|
||||||
|
-Dextension=xhtml
|
||||||
|
-Dfile=${f}
|
||||||
|
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,34 +4,73 @@
|
|||||||
# Copyright (c) 2012 Kornel Benko kornel@lyx.org
|
# Copyright (c) 2012 Kornel Benko kornel@lyx.org
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# LYX_ROOT = ${TOP_SRC_DIR}
|
# LYX_ROOT = ${TOP_SRC_DIR}/lib/doc
|
||||||
# lyx = ${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/lyx
|
# lyx =
|
||||||
|
# format = lyx16x|xhtml
|
||||||
|
# extension = 16.lyx|xhtml
|
||||||
|
# file = xxx
|
||||||
#
|
#
|
||||||
# Script should be called like:
|
# Script should be called like:
|
||||||
# cmake -DLYX_ROOT=xxx \
|
# cmake -DLYX_ROOT=xxx \
|
||||||
# -Dlyx=xxx \
|
# -Dlyx=xxx \
|
||||||
|
# -Dformat=xxx \
|
||||||
|
# -Dextension=xxx \
|
||||||
|
# -Dfile=xxx \
|
||||||
# -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
|
# -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
|
||||||
#
|
#
|
||||||
file(GLOB lyx_files "${LYX_ROOT}/lib/doc/*.lyx")
|
|
||||||
message(STATUS "lyx_files = ${lyx_files}")
|
|
||||||
|
|
||||||
set(ERRORS)
|
message(STATUS "Executing ${lyx} -E ${format} ${file}.${extension} ${LYX_ROOT}/${file}.lyx")
|
||||||
foreach(format lyx16x xhtml)
|
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
|
||||||
foreach(f ${lyx_files})
|
execute_process(
|
||||||
message(STATUS "Executing ${lyx} -E ${format} localtest.${format} ${f}")
|
COMMAND ${lyx} -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E remove localtest.xhtml localtest.16.lyx)
|
RESULT_VARIABLE _err)
|
||||||
execute_process(
|
string(COMPARE NOTEQUAL ${_err} 0 _erg)
|
||||||
COMMAND ${lyx} -E ${format} localtest.${format} ${f}
|
if(erg)
|
||||||
RESULT_VARIABLE _err)
|
message(STATUS "Exporting ${f}.lyx to ${format}")
|
||||||
string(COMPARE NOTEQUAL ${_err} 0 _erg)
|
|
||||||
if(_erg)
|
|
||||||
list(APPEND ERRORS "Exporting ${f} to ${format}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endforeach()
|
|
||||||
if(ERRORS)
|
|
||||||
foreach(m ${ERRORS})
|
|
||||||
message(STATUS ${m})
|
|
||||||
endforeach()
|
|
||||||
message(FATAL_ERROR "Export failed")
|
message(FATAL_ERROR "Export failed")
|
||||||
endif()
|
endif()
|
||||||
|
# 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
|
||||||
|
# LOCALE_DIR = ${BUILD_DIR}/autotests/locale
|
||||||
|
# PO_BUILD_DIR = ${BUILD_DIR}/po
|
||||||
|
# PACKAGE = lyx2.1
|
||||||
|
#
|
||||||
|
# Script should be called like:
|
||||||
|
# cmake -DAUTOTEST_ROOT=xxxx \
|
||||||
|
# -DKEYTEST_INFILE=xxxx \
|
||||||
|
# -DKEYTEST_OUTFILE=xxx \
|
||||||
|
# -DBINDIR=xxx \
|
||||||
|
# -DWORKDIR=xxx \
|
||||||
|
# -DLOCALE_DIR=xxx \
|
||||||
|
# -DPO_BUILD_DIR=xxx \
|
||||||
|
# -DPACKAGE=xxx \
|
||||||
|
# -P ${AUTOTEST_ROOT}/single-test.cmake
|
||||||
|
|
||||||
|
set(KEYTEST "${AUTOTEST_ROOT}/keytest.py")
|
||||||
|
|
||||||
|
execute_process(COMMAND pidof lyx OUTPUT_VARIABLE LYX_PID RESULT_VARIABLE pidstat OUTPUT_VARIABLE pidres)
|
||||||
|
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()
|
||||||
|
@ -51,7 +51,7 @@ set(XVKBD_EXE "${BINDIR}/xvkbd")
|
|||||||
set(ENV{PACKAGE} ${PACKAGE})
|
set(ENV{PACKAGE} ${PACKAGE})
|
||||||
set(ENV{LOCALE_DIR} ${LOCALE_DIR})
|
set(ENV{LOCALE_DIR} ${LOCALE_DIR})
|
||||||
set(ENV{LYX_LOCALEDIR} "${WORKDIR}/../locale")
|
set(ENV{LYX_LOCALEDIR} "${WORKDIR}/../locale")
|
||||||
set(ENV{LYX_USERDIR} ${LYX_USERDIR})
|
set(ENV{LYX_USERDIR} ${WORKDIR})
|
||||||
set(ENV{LYX_PID} ${pidres})
|
set(ENV{LYX_PID} ${pidres})
|
||||||
set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
|
set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
|
||||||
set(ENV{LYX_EXE} ${LYX_EXE})
|
set(ENV{LYX_EXE} ${LYX_EXE})
|
||||||
@ -59,7 +59,8 @@ set(ENV{XVKBD_EXE} ${XVKBD_EXE})
|
|||||||
set(ENV{KEYTEST_INFILE} "${AUTOTEST_ROOT}/${KEYTEST_INFILE}")
|
set(ENV{KEYTEST_INFILE} "${AUTOTEST_ROOT}/${KEYTEST_INFILE}")
|
||||||
set(ENV{KEYTEST_OUTFILE} "${WORKDIR}/${KEYTEST_OUTFILE}")
|
set(ENV{KEYTEST_OUTFILE} "${WORKDIR}/${KEYTEST_OUTFILE}")
|
||||||
set(ENV{PO_BUILD_DIR} "${PO_BUILD_DIR}")
|
set(ENV{PO_BUILD_DIR} "${PO_BUILD_DIR}")
|
||||||
set(ENV{MAX_DROP} 1)
|
set(ENV{MAX_DROP} 0)
|
||||||
|
set(ENV{MAX_LOOP} 1)
|
||||||
file(GLOB _testfiles RELATIVE "${WORKDIR}" "test*.*" "#test*.*")
|
file(GLOB _testfiles RELATIVE "${WORKDIR}" "test*.*" "#test*.*")
|
||||||
if(_testfiles)
|
if(_testfiles)
|
||||||
# remove some leftover files from previous test
|
# remove some leftover files from previous test
|
||||||
|
Loading…
Reference in New Issue
Block a user