Cmake lyxxx export tests: Add summary of commands to log

This commit is contained in:
Kornel Benko 2019-01-23 23:07:54 +01:00
parent 49583b7dd0
commit d31dc599ff

View File

@ -31,6 +31,7 @@
# -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
#
set(_TestResultMessage "")
message(STATUS "IgnoreErrorMessage = \"${IgnoreErrorMessage}\"")
set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
set(Structure_Script "${TOP_SRC_DIR}/development/autotests/beginEndStructureCheck.pl")
@ -106,6 +107,7 @@ if (extension MATCHES "\\.lyx$")
include(${TOP_SRC_DIR}/development/autotests/CheckLoadErrors.cmake)
get_md5sum(LYX_SOURCE source_md5sum _err)
foreach(_lv RANGE 1 20)
set(used_tex_file "${result_file_base}.tex")
set(result_file_base "${result_file_base}.${LYX_FORMAT_NUM}")
set(result_file_name "${result_file_base}.lyx")
file(REMOVE "${result_file_name}" "${result_file_name}.emergency" )
@ -115,29 +117,51 @@ 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}")
if(_err)
break()
elseif(NOT EXISTS "${result_file_name}")
message(STATUS "Expected result file \"${result_file_name}\" does not exist")
set(_err -1)
list(APPEND _TestResultMessage "Error: ${_mymsg}")
break()
else()
message(STATUS "Expected result file \"${result_file_name}\" exists")
execute_process(
COMMAND ${PERL_EXECUTABLE} ${Structure_Script} "${WORKDIR}/${result_file_name}"
RESULT_VARIABLE _err)
if(_err)
break()
endif()
checkLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
if(_err)
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)
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}\"")
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}")
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)
endif()
endif()
get_md5sum(result_file_name result_md5sum _err)
set(_mymsg "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})
@ -154,12 +178,20 @@ 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()
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()
endif()
endif()
@ -226,7 +258,13 @@ if(inverted)
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})
message(STATUS "\t${_l}")
endforeach()
endif()
if(_erg)
message(STATUS "Exporting ${file}.lyx to ${format}")
message(FATAL_ERROR "Export failed")