Cmake export tests: Expand summary messages

Summary log messages are now used also for xhtml exports
This commit is contained in:
Kornel Benko 2019-01-27 13:25:29 +01:00
parent e973f3abf9
commit 05fb3114d5

View File

@ -100,6 +100,14 @@ function(get_md5sum msource mresult mreserr)
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{LC_ALL} "C")
@ -117,51 +125,39 @@ if (extension MATCHES "\\.lyx$")
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})
@ -178,21 +174,16 @@ if (extension MATCHES "\\.lyx$")
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})
@ -215,17 +206,18 @@ else()
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}"
@ -233,18 +225,21 @@ else()
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()