# Copyright (c) 2012 Kornel Benko kornel@lyx.org
#
#
-# LYX_ROOT = ${TOP_SRC_DIR}/lib/{doc,examples,templates}
+# LYX_ROOT = ${TOP_SRC_DIR}/lib/{doc,examples,templates,tabletemplates}
# LYX_USERDIR_VER = Name of environment variable for the user directory
# lyx =
# format = lyx16x|lyx20x|lyx21x|lyx22x|xhtml
set(${mreserr} ${mres_err} PARENT_SCOPE)
endfunction()
+macro(Summary _err _msg)
+ if (${_err})
+ list(APPEND _TestResultMessage "Error: ${_msg}")
+ else()
+ list(APPEND _TestResultMessage "OK: ${_msg}")
+ endif()
+endmacro()
+
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
set(ENV{LANG} "en_US.UTF-8") # to get all error-messages in english
+set(ENV{LANGUAGE} "US:en")
#set(ENV{LC_ALL} "C")
if (extension MATCHES "\\.lyx$")
include(${TOP_SRC_DIR}/development/autotests/CheckLoadErrors.cmake)
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${result_file_name} "${LYX_SOURCE}"
RESULT_VARIABLE _err
ERROR_VARIABLE lyxerr)
- set(_mymsg "Converting \"${LYX_SOURCE}\" to format ${format}")
+ Summary(_err "Converting \"${LYX_SOURCE}\" to format ${format}")
if(_err)
- list(APPEND _TestResultMessage "Error: ${_mymsg}")
break()
else()
- list(APPEND _TestResultMessage "OK: ${_mymsg}")
if(NOT EXISTS "${result_file_name}")
- message(STATUS "Expected result file \"${result_file_name}\" does not exist")
- list(APPEND _TestResultMessage "Error: The conversion of \"${LYX_SOURCE}\" to format ${format} did not create result file \"${result_file_name}\"")
set(_err -1)
+ Summary(_err "Expected result file \"${result_file_name}\" does not exist")
break()
else()
message(STATUS "Expected result file \"${result_file_name}\" exists")
execute_process(
COMMAND ${PERL_EXECUTABLE} ${Structure_Script} "${result_file_name}"
RESULT_VARIABLE _err)
- set(_mymsg "Structure of the intermediate file \"${result_file_name}\"")
+ Summary(_err "Structure of the intermediate file \"${result_file_name}\"")
if(_err)
- list(APPEND _TestResultMessage "Error: ${_mymsg} seems to be broken")
break()
- else()
- list(APPEND _TestResultMessage "OK: ${_mymsg}")
endif()
checkLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
- set(_mymsg "Examination of error/warning messages of the conversion of \"${LYX_SOURCE}\" to format ${format}")
+ Summary(_err "Examination of error/warning messages of the conversion of \"${LYX_SOURCE}\" to format ${format}")
if(_err)
- list(APPEND _TestResultMessage "Error: ${_mymsg}")
break()
- else()
- list(APPEND _TestResultMessage "OK: ${_mymsg}")
endif()
message(STATUS "Create the corresponding .tex file \"${used_tex_file}\"")
execute_process(
- COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E pdflatex ${used_tex_file} "${LYX_SOURCE}"
- RESULT_VARIABLE _errx)
+ COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E pdflatex ${used_tex_file} "${LYX_SOURCE}"
+ RESULT_VARIABLE _errx)
endif()
endif()
get_md5sum(result_file_name result_md5sum _err)
- set(_mymsg "Getting md5sum of \"${result_file_name}\"")
+ Summary(_err "Getting md5sum of \"${result_file_name}\"")
if(_err)
# Somehow the created file is not readable?
- list(APPEND _TestResultMessage "Error: ${_mymsg}")
break()
- else()
- list(APPEND _TestResultMessage "OK: ${_mymsg}")
endif()
# Check if result file identical to source file
if(result_md5sum STREQUAL ${source_md5sum})
# files with relative path
message(STATUS "Not exporting due to missing \\origin statement")
break()
+ elseif(format MATCHES "lyx22x" AND file MATCHES "Minted")
+ message(STATUS "Not exporting due to missing minted support")
+ break()
endif()
message(STATUS "Source(${LYX_SOURCE}) and dest(${result_file_name}) are equal")
message(STATUS "Now try to export the lyx2lyx created file")
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E default "${result_file_name}.default" "${result_file_name}"
RESULT_VARIABLE _err
ERROR_VARIABLE lyxerr)
- set(_mymsg "Test-compilation of \"${result_file_name}\" to format default")
- if (_err)
- list(APPEND _TestResultMessage "Error: ${_mymsg}")
- else()
- list(APPEND _TestResultMessage "OK: ${_mymsg}")
- endif()
+ Summary(_err "Test-compilation of \"${result_file_name}\" to format default")
break()
else()
list(APPEND _TestResultMessage "Warning: \"${LYX_SOURCE}\" and \"${result_file_name}\" differ")
message(STATUS "Source(${LYX_SOURCE}) and dest(${result_file_name}) are still different")
if (_lv GREATER 10)
- set(_err 1)
- message(STATUS "Possible endless loop encountered")
- list(APPEND _TestResultMessage "Error: Test-Loop exceeded the count of 10, Possible endless loop")
- break()
+ set(_err 1)
+ message(STATUS "Possible endless loop encountered")
+ Summary(_err "Test-Loop exceeded the count of 10, Possible endless loop")
+ break()
endif()
endif()
set(source_md5sum ${result_md5sum})
execute_process(
COMMAND ${lyx} ${LyXExtraParams} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${result_file_name} "${LYX_SOURCE}"
RESULT_VARIABLE _err)
-
- #check if result file created
+ Summary(_err "Exporting \"${LYX_SOURCE}\" to format ${format}")
if (NOT _err)
+ #check if result file created
if (NOT EXISTS "${result_file_name}")
message(STATUS "Expected result file \"${result_file_name}\" does not exist")
set(_err -1)
+ Summary(_err "Expected result file \"${result_file_name}\" does not exists")
else()
message(STATUS "Expected result file \"${result_file_name}\" exists")
if (format MATCHES "xhtml")
if (XMLLINT_EXECUTABLE)
- message(STATUS "Calling: ${XMLLINT_EXECUTABLE} --sax --html --valid")
+ message(STATUS "Calling: ${XMLLINT_EXECUTABLE} --sax --html --valid")
# check the created xhtml file
execute_process(
COMMAND ${XMLLINT_EXECUTABLE} --sax --html --valid "${result_file_name}"
ERROR_VARIABLE xmlerr
RESULT_VARIABLE _err)
file(WRITE "${result_file_name}.sax_out" ${xmlout})
+ Summary(_err "Checking \"${result_file_name}\" with ${XMLLINT_EXECUTABLE}")
if (NOT _err)
# check if sax-parser output contains error messages
- message(STATUS "Check the output: ${PERL_EXECUTABLE} ${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl")
+ message(STATUS "Check the output: ${PERL_EXECUTABLE} ${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl")
execute_process(
COMMAND ${PERL_EXECUTABLE} "${TOP_SRC_DIR}/development/autotests/examineXmllintOutput.pl" "${result_file_name}.sax_out"
OUTPUT_VARIABLE xmlout
RESULT_VARIABLE _err)
+ Summary(_err "Parse messages of ${XMLLINT_EXECUTABLE} for errors")
endif()
if (NOT _err)
if (NOT "${xmlout}" STREQUAL "")
message(STATUS "${xmlout}")
set(_err -1)
+ Summary(_err "Non empty output of \"${XMLLINT_EXECUTABLE}\"")
endif()
endif()
endif()
else()
string(COMPARE NOTEQUAL ${_err} 0 _erg)
endif()
-#execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${TempDir}")
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${TempDir}")
if(_TestResultMessage)
message(STATUS "Msg Summary:")
foreach(_l ${_TestResultMessage})