2012-12-12 17:23:25 +00:00
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# Licence details can be found in the file COPYING.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 Kornel Benko kornel@lyx.org
|
|
|
|
#
|
|
|
|
#
|
2019-03-26 14:27:39 +00:00
|
|
|
# LYX_ROOT = ${TOP_SRC_DIR}/lib/{doc,examples,templates,tabletemplates}
|
2013-08-21 11:34:26 +00:00
|
|
|
# LYX_USERDIR_VER = Name of environment variable for the user directory
|
2014-01-05 09:02:29 +00:00
|
|
|
# lyx =
|
2024-09-17 16:42:46 +00:00
|
|
|
# format = lyx16x|lyx20x|lyx21x|lyx22x|lyx23x|xhtml|docbook5|epub
|
|
|
|
# extension = 16.lyx|20.lyx|21.lyx|22.lyx|23.lyx|xhtml|xml|epub
|
2012-12-13 11:38:38 +00:00
|
|
|
# file = xxx
|
2012-12-12 17:23:25 +00:00
|
|
|
#
|
|
|
|
# Script should be called like:
|
|
|
|
# cmake -DLYX_ROOT=xxx \
|
2013-08-25 09:41:10 +00:00
|
|
|
# -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
|
2013-08-21 11:34:26 +00:00
|
|
|
# -DWORKDIR=${BUILD_DIR}/autotests/out-home \
|
|
|
|
# -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
|
2012-12-12 17:23:25 +00:00
|
|
|
# -Dlyx=xxx \
|
2012-12-13 11:38:38 +00:00
|
|
|
# -Dformat=xxx \
|
2013-12-16 10:36:36 +00:00
|
|
|
# -Dfonttype=xxx \
|
2012-12-13 11:38:38 +00:00
|
|
|
# -Dextension=xxx \
|
2015-12-28 05:00:10 +00:00
|
|
|
# -DLYX_FORMAT_NUM=${_lyx_format_num} \
|
2012-12-13 11:38:38 +00:00
|
|
|
# -Dfile=xxx \
|
2015-12-02 23:23:07 +00:00
|
|
|
# -Dinverted=[01] \
|
2016-11-09 23:56:49 +00:00
|
|
|
# -DTOP_SRC_DIR=${TOP_SRC_DIR} \
|
2017-01-11 09:15:13 +00:00
|
|
|
# -DIgnoreErrorMessage=(ON/OFF) \
|
2016-11-09 23:56:49 +00:00
|
|
|
# -DPERL_EXECUTABLE=${PERL_EXECUTABLE} \
|
2023-01-08 16:12:16 +00:00
|
|
|
# -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE} \
|
2016-11-09 23:56:49 +00:00
|
|
|
# -DXMLLINT_EXECUTABLE=${XMLLINT_EXECUTABLE} \
|
2020-10-10 10:43:17 +00:00
|
|
|
# -DJAVA_EXECUTABLE=${JAVA_EXECUTABLE} \
|
2016-11-09 23:56:49 +00:00
|
|
|
# -DENCODING=xxx \
|
2012-12-12 17:23:25 +00:00
|
|
|
# -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
|
|
|
|
#
|
2012-12-11 14:17:04 +00:00
|
|
|
|
2019-01-23 22:07:54 +00:00
|
|
|
set(_TestResultMessage "")
|
2017-04-24 15:44:31 +00:00
|
|
|
message(STATUS "IgnoreErrorMessage = \"${IgnoreErrorMessage}\"")
|
2013-11-17 22:17:27 +00:00
|
|
|
set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
|
2015-12-27 13:33:11 +00:00
|
|
|
set(Structure_Script "${TOP_SRC_DIR}/development/autotests/beginEndStructureCheck.pl")
|
2024-09-17 16:42:46 +00:00
|
|
|
set(readDefaultOutputFormat "${TOP_SRC_DIR}/development/autotests/readDefaultOutputFormat.pl")
|
2015-11-10 18:42:43 +00:00
|
|
|
set(LanguageFile "${TOP_SRC_DIR}/lib/languages")
|
2015-03-28 20:21:16 +00:00
|
|
|
set(GetTempDir "${TOP_SRC_DIR}/development/autotests/getTempDir.pl")
|
2013-12-16 10:36:36 +00:00
|
|
|
set(_ft ${fonttype})
|
2015-03-28 20:21:16 +00:00
|
|
|
execute_process(COMMAND ${PERL_EXECUTABLE} "${GetTempDir}" "${WORKDIR}" OUTPUT_VARIABLE TempDir)
|
2013-12-16 10:36:36 +00:00
|
|
|
message(STATUS "using fonttype = ${_ft}")
|
2016-11-09 23:56:49 +00:00
|
|
|
if(NOT ENCODING)
|
|
|
|
set(ENCODING "default")
|
|
|
|
endif()
|
|
|
|
if(ENCODING STREQUAL "default")
|
|
|
|
set(_enc)
|
|
|
|
else()
|
|
|
|
set(_enc "_${ENCODING}")
|
|
|
|
endif()
|
2020-08-01 07:35:20 +00:00
|
|
|
|
|
|
|
# move the the last directory part of LYX_ROOT to filename
|
|
|
|
# to make the destination unique for otherwise identical
|
|
|
|
# filenames
|
|
|
|
get_filename_component(updir_ "${LYX_ROOT}" DIRECTORY)
|
|
|
|
get_filename_component(updir2_ "${LYX_ROOT}" NAME)
|
|
|
|
set(file "${updir2_}/${file}")
|
|
|
|
set(LYX_ROOT "${updir_}")
|
2023-01-08 16:12:16 +00:00
|
|
|
set(NO_FAILES 0)
|
2020-08-01 07:35:20 +00:00
|
|
|
|
2015-11-29 15:11:10 +00:00
|
|
|
if(format MATCHES "dvi|pdf")
|
2013-11-17 22:17:27 +00:00
|
|
|
message(STATUS "LYX_TESTS_USERDIR = ${LYX_TESTS_USERDIR}")
|
|
|
|
message(STATUS "Converting with perl ${Perl_Script}")
|
2016-11-09 23:56:49 +00:00
|
|
|
set(LYX_SOURCE "${TempDir}/${file}_${format}_${_ft}${_enc}.lyx")
|
2013-11-17 22:17:27 +00:00
|
|
|
message(STATUS "Using source \"${LYX_ROOT}/${file}.lyx\"")
|
|
|
|
message(STATUS "Using dest \"${LYX_SOURCE}\"")
|
2016-11-09 23:56:49 +00:00
|
|
|
if(NOT "${ENCODING}" STREQUAL "default")
|
|
|
|
# message(STATUS "ENCODING = ${ENCODING}")
|
|
|
|
endif()
|
2017-11-17 16:53:52 +00:00
|
|
|
message(STATUS "Executing ${PERL_EXECUTABLE} \"${Perl_Script}\" \"${LYX_ROOT}/${file}.lyx\" \"${LYX_SOURCE}\" ${format} ${_ft} ${ENCODING} ${LanguageFile}")
|
2016-11-09 23:56:49 +00:00
|
|
|
execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} ${_ft} ${ENCODING} ${LanguageFile}
|
2013-11-17 22:17:27 +00:00
|
|
|
RESULT_VARIABLE _err)
|
|
|
|
string(COMPARE EQUAL ${_err} 0 _erg)
|
|
|
|
if(NOT _erg)
|
2023-01-08 16:12:16 +00:00
|
|
|
set(NO_FAILES 1)
|
2013-11-17 22:17:27 +00:00
|
|
|
message(FATAL_ERROR "Export failed while converting")
|
|
|
|
endif()
|
2020-11-15 22:40:02 +00:00
|
|
|
# We only need "_${ENCODING}" for unicode tests (because multiple encodings
|
|
|
|
# are tested with the same format), but doesn't hurt to include for all.
|
|
|
|
set(result_file_name ${file}_${_ft}_${ENCODING}.${extension})
|
2013-11-17 22:17:27 +00:00
|
|
|
else()
|
2019-01-03 07:46:26 +00:00
|
|
|
message(STATUS "Converting with perl ${Perl_Script}")
|
|
|
|
set(LYX_SOURCE "${TempDir}/${file}.lyx")
|
|
|
|
message(STATUS "Using source \"${LYX_ROOT}/${file}.lyx\"")
|
|
|
|
message(STATUS "Using dest \"${LYX_SOURCE}\"")
|
2019-01-05 07:34:00 +00:00
|
|
|
execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} "dontChange" "default" ${LanguageFile}
|
2019-01-03 07:46:26 +00:00
|
|
|
RESULT_VARIABLE _err)
|
|
|
|
string(COMPARE EQUAL ${_err} 0 _erg)
|
|
|
|
if(NOT _erg)
|
2023-01-08 16:12:16 +00:00
|
|
|
set(NO_FAILES 1)
|
2019-01-03 07:46:26 +00:00
|
|
|
message(FATAL_ERROR "Export failed while converting")
|
2023-01-08 16:12:16 +00:00
|
|
|
endif()
|
2015-12-28 07:37:58 +00:00
|
|
|
if(extension MATCHES "\\.lyx$")
|
2019-01-17 11:27:12 +00:00
|
|
|
# Font-type not relevant for lyx16/lyx2[0123] exports
|
2019-01-04 04:21:07 +00:00
|
|
|
set(result_file_base "${TempDir}/${file}")
|
2015-12-28 07:37:58 +00:00
|
|
|
else()
|
|
|
|
set(result_file_name ${file}.${extension})
|
|
|
|
endif()
|
2013-11-17 22:17:27 +00:00
|
|
|
endif()
|
|
|
|
|
2015-12-29 12:23:08 +00:00
|
|
|
function(get_md5sum msource mresult mreserr)
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E md5sum ${${msource}}
|
|
|
|
OUTPUT_VARIABLE msource_md5sum_x
|
|
|
|
RESULT_VARIABLE mres_err)
|
|
|
|
if (NOT mres_err)
|
|
|
|
string(REGEX REPLACE " .*" "" msource_md5sum ${msource_md5sum_x})
|
|
|
|
set(${mresult} ${msource_md5sum} PARENT_SCOPE)
|
|
|
|
message(STATUS "MD5SUM of \"${${msource}}\" is ${msource_md5sum}")
|
|
|
|
else()
|
|
|
|
set(${mresult} "xx" PARENT_SCOPE)
|
|
|
|
message(STATUS "Error getting MD5SUM of \"${${msource}}\"")
|
|
|
|
endif()
|
|
|
|
set(${mreserr} ${mres_err} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2019-01-27 12:25:29 +00:00
|
|
|
macro(Summary _err _msg)
|
2023-01-20 15:51:38 +00:00
|
|
|
#message(STATUS "Summary called with err=${_err}, msg=${_msg}")
|
|
|
|
if (_err)
|
2023-01-08 16:12:16 +00:00
|
|
|
MATH(EXPR NO_FAILES "${NO_FAILES}+1")
|
2019-01-27 12:25:29 +00:00
|
|
|
list(APPEND _TestResultMessage "Error: ${_msg}")
|
|
|
|
else()
|
|
|
|
list(APPEND _TestResultMessage "OK: ${_msg}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2023-01-20 15:51:38 +00:00
|
|
|
macro(validate_output output outputfile errmsg errx)
|
|
|
|
if (NOT "${output}" STREQUAL "")
|
|
|
|
file(WRITE "${outputfile}" "${output}")
|
|
|
|
MATH(EXPR NO_FAILES "${NO_FAILES}+1")
|
|
|
|
Summary(${errx} "Validating \"${outputfile}\", ${errmsg}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2023-01-08 16:12:16 +00:00
|
|
|
macro(check_xhtml_validate xhtml_file)
|
|
|
|
message(STATUS "Calling ${LYX_PYTHON_EXECUTABLE} \"${TOP_SRC_DIR}/development/autotests/simplehtml_validity.py\" \"${TempDir}/${xhtml_file}\"")
|
|
|
|
set(_outputfile "${TempDir}/${xhtml_file}.validate_out")
|
2023-01-20 15:51:38 +00:00
|
|
|
set(_errorfile "${TempDir}/${xhtml_file}.validate_err")
|
2023-01-08 16:12:16 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_SRC_DIR}/development/autotests/simplehtml_validity.py" "${TempDir}/${xhtml_file}"
|
|
|
|
WORKING_DIRECTORY "${TempDir}"
|
|
|
|
OUTPUT_VARIABLE xmlout
|
|
|
|
ERROR_VARIABLE xmlerr
|
|
|
|
RESULT_VARIABLE _err)
|
|
|
|
if (NOT "${xmlout}" STREQUAL "")
|
2023-01-20 15:51:38 +00:00
|
|
|
if ("${xmlout}" MATCHES "Error: ")
|
|
|
|
validate_output("${xmlout}" "${_outputfile}" "found errors" -5)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
validate_output("${xmlerr}" "${_errorfile}" "Not emty" -6)
|
|
|
|
if (NO_FAILES EQUAL 0 AND ${_err} EQUAL 254)
|
|
|
|
# Ignore this result, validate the outputs only instead
|
|
|
|
set(_err 0)
|
2023-01-08 16:12:16 +00:00
|
|
|
endif()
|
2023-01-20 15:51:38 +00:00
|
|
|
Summary(${_err} "Calling simplehtml_validity.py, result=${_err}")
|
2023-01-08 16:12:16 +00:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(check_xhtml_xmllint xhtml_file)
|
|
|
|
set(xmllint_params --loaddtd --noout)
|
|
|
|
string(REPLACE ";" " " xmllint_params2 " ${xmllint_params}")
|
|
|
|
message(STATUS "Calling: " ${XMLLINT_EXECUTABLE} ${xmllint_params2} " \"${TempDir}/${xhtml_file}\"")
|
|
|
|
set(_outputfile "${TempDir}/${xhtml_file}.sax_out")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${XMLLINT_EXECUTABLE} ${xmllint_params} "${xhtml_file}"
|
|
|
|
WORKING_DIRECTORY "${TempDir}"
|
|
|
|
OUTPUT_VARIABLE xmlout
|
|
|
|
ERROR_VARIABLE xmlerr
|
|
|
|
RESULT_VARIABLE _err)
|
|
|
|
file(WRITE "${_outputfile}" ${xmlout})
|
2023-01-20 15:51:38 +00:00
|
|
|
Summary(${_err} "Checking \"${TempDir}/${xhtml_file}\" with ${XMLLINT_EXECUTABLE}")
|
2023-01-08 16:12:16 +00:00
|
|
|
if (NOT _err)
|
|
|
|
# check if parser output contains error messages
|
|
|
|
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" "${_outputfile}"
|
|
|
|
WORKING_DIRECTORY "${TempDir}"
|
|
|
|
OUTPUT_VARIABLE xmlout
|
|
|
|
RESULT_VARIABLE _err)
|
2023-01-20 15:51:38 +00:00
|
|
|
Summary(${_err} "Parse messages of ${XMLLINT_EXECUTABLE} for errors")
|
2023-01-08 16:12:16 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "Errors from xmllint: ${xmlerr}")
|
|
|
|
endif()
|
|
|
|
if (NOT _err)
|
|
|
|
if (NOT "${xmlout}" STREQUAL "")
|
|
|
|
message(STATUS "${xmlout}")
|
|
|
|
set(_err -1)
|
2023-01-20 15:51:38 +00:00
|
|
|
Summary(${_err} "Non empty output \"${_outputfile}\" of \"${XMLLINT_EXECUTABLE}\"")
|
2023-01-08 16:12:16 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(check_xhtml_xmlparser xhtml_file)
|
|
|
|
message(STATUS "Calling ${PERL_EXECUTABLE} \"${TOP_SRC_DIR}/development/autotests/xmlParser.pl\" \"${xhtml_file}\"")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${PERL_EXECUTABLE} "${TOP_SRC_DIR}/development/autotests/xmlParser.pl" "${result_file_name}"
|
|
|
|
WORKING_DIRECTORY "${TempDir}"
|
|
|
|
OUTPUT_VARIABLE parserout
|
|
|
|
ERROR_VARIABLE parsererr
|
|
|
|
RESULT_VARIABLE _err
|
|
|
|
)
|
|
|
|
if (_err)
|
|
|
|
message(STATUS "${parsererr}")
|
|
|
|
endif()
|
|
|
|
Summary(_err "Checking \"${TempDir}/${xhtml_file}\" with xmlParser.pl")
|
|
|
|
endmacro()
|
|
|
|
|
2023-01-09 03:19:51 +00:00
|
|
|
macro(check_docbook_jing xhtml_file)
|
2023-01-08 16:12:16 +00:00
|
|
|
message(STATUS "Calling: ${JAVA_EXECUTABLE} -jar \"${TOP_SRC_DIR}/development/tools/jing.jar\" \"https://docbook.org/xml/5.2b09/rng/docbook.rng\" \"${TempDir}/${xhtml_file}\"")
|
|
|
|
set(_outputfile "${TempDir}/${xhtml_file}.jing_out")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${JAVA_EXECUTABLE} -jar "${TOP_SRC_DIR}/development/tools/jing.jar" "https://docbook.org/xml/5.2b09/rng/docbook.rng" "${xhtml_file}"
|
|
|
|
WORKING_DIRECTORY "${TempDir}"
|
|
|
|
OUTPUT_VARIABLE jingout
|
|
|
|
RESULT_VARIABLE _err)
|
|
|
|
file(WRITE "${_outputfile}" ${jingout})
|
|
|
|
message(STATUS "_err = ${_err}, jingout = ${jingout}")
|
|
|
|
Summary(_err "Checking for empty output \"${_outputfile}\" of ${JAVA_EXECUTABLE} -jar \"${TOP_SRC_DIR}/development/tools/jing.jar\"")
|
|
|
|
endmacro()
|
|
|
|
|
2013-08-25 09:41:10 +00:00
|
|
|
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
|
2017-10-02 08:35:57 +00:00
|
|
|
set(ENV{LANG} "en_US.UTF-8") # to get all error-messages in english
|
2019-03-13 18:49:11 +00:00
|
|
|
set(ENV{LANGUAGE} "US:en")
|
2017-10-02 08:35:57 +00:00
|
|
|
#set(ENV{LC_ALL} "C")
|
2015-12-28 05:00:10 +00:00
|
|
|
if (extension MATCHES "\\.lyx$")
|
|
|
|
include(${TOP_SRC_DIR}/development/autotests/CheckLoadErrors.cmake)
|
2015-12-29 12:23:08 +00:00
|
|
|
get_md5sum(LYX_SOURCE source_md5sum _err)
|
2024-09-17 16:42:46 +00:00
|
|
|
message(STATUS "Executing ${PERL_EXECUTABLE} ${readDefaultOutputFormat} ${LYX_SOURCE}")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${PERL_EXECUTABLE} ${readDefaultOutputFormat} "${LYX_SOURCE}"
|
|
|
|
OUTPUT_VARIABLE _export_format)
|
|
|
|
message(STATUS "readDefaultOutputFormat = ${_export_format}")
|
|
|
|
if (${_export_format} MATCHES "pdf2")
|
|
|
|
set(_texformat "pdflatex")
|
2024-09-17 19:41:48 +00:00
|
|
|
elseif(${_export_format} MATCHES "pdf3")
|
2024-09-17 16:42:46 +00:00
|
|
|
set(_texformat "platex")
|
2024-09-17 19:41:48 +00:00
|
|
|
elseif(${_export_format} MATCHES "pdf4")
|
2024-09-17 16:42:46 +00:00
|
|
|
set(_texformat "xetex")
|
2024-09-17 19:41:48 +00:00
|
|
|
elseif(${_export_format} MATCHES "pdf5")
|
2024-09-17 16:42:46 +00:00
|
|
|
set(_texformat "luatex")
|
|
|
|
else()
|
|
|
|
set(_texformat "empty")
|
|
|
|
endif()
|
|
|
|
|
2018-01-22 13:43:50 +00:00
|
|
|
foreach(_lv RANGE 1 20)
|
2019-01-23 22:07:54 +00:00
|
|
|
set(used_tex_file "${result_file_base}.tex")
|
2015-12-28 05:00:10 +00:00
|
|
|
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" )
|
|
|
|
message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${result_file_name} \"${LYX_SOURCE}\"")
|
2015-12-29 12:23:08 +00:00
|
|
|
message(STATUS "This implicitly checks load of ${LYX_SOURCE}")
|
2015-12-25 09:28:40 +00:00
|
|
|
execute_process(
|
2015-12-28 05:00:10 +00:00
|
|
|
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${result_file_name} "${LYX_SOURCE}"
|
2015-12-25 09:28:40 +00:00
|
|
|
RESULT_VARIABLE _err
|
|
|
|
ERROR_VARIABLE lyxerr)
|
2019-01-27 12:25:29 +00:00
|
|
|
Summary(_err "Converting \"${LYX_SOURCE}\" to format ${format}")
|
2015-12-28 05:00:10 +00:00
|
|
|
if(_err)
|
2015-12-29 12:23:08 +00:00
|
|
|
break()
|
2015-12-28 05:00:10 +00:00
|
|
|
else()
|
2019-01-23 22:07:54 +00:00
|
|
|
if(NOT EXISTS "${result_file_name}")
|
|
|
|
set(_err -1)
|
2019-01-27 12:25:29 +00:00
|
|
|
Summary(_err "Expected result file \"${result_file_name}\" does not exist")
|
2015-12-28 05:00:10 +00:00
|
|
|
break()
|
2019-01-23 22:07:54 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "Expected result file \"${result_file_name}\" exists")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${PERL_EXECUTABLE} ${Structure_Script} "${result_file_name}"
|
|
|
|
RESULT_VARIABLE _err)
|
2019-01-27 12:25:29 +00:00
|
|
|
Summary(_err "Structure of the intermediate file \"${result_file_name}\"")
|
2019-01-23 22:07:54 +00:00
|
|
|
if(_err)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
checkLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
|
2019-01-27 12:25:29 +00:00
|
|
|
Summary(_err "Examination of error/warning messages of the conversion of \"${LYX_SOURCE}\" to format ${format}")
|
2019-01-23 22:07:54 +00:00
|
|
|
if(_err)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
message(STATUS "Create the corresponding .tex file \"${used_tex_file}\"")
|
2024-09-17 16:42:46 +00:00
|
|
|
if (NOT ${_texformat} MATCHES "empty")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${_texformat} ${used_tex_file} "${LYX_SOURCE}"
|
|
|
|
RESULT_VARIABLE _errx)
|
|
|
|
endif()
|
2024-09-17 19:49:48 +00:00
|
|
|
if(_errx)
|
|
|
|
set(_err -1)
|
|
|
|
Summary(_err "Exporting ${LYX_SOURCE} to format ${_texformat} failed")
|
|
|
|
break()
|
|
|
|
endif()
|
2015-12-27 19:05:37 +00:00
|
|
|
endif()
|
2015-12-25 09:28:40 +00:00
|
|
|
endif()
|
2015-12-29 12:23:08 +00:00
|
|
|
get_md5sum(result_file_name result_md5sum _err)
|
2019-01-27 12:25:29 +00:00
|
|
|
Summary(_err "Getting md5sum of \"${result_file_name}\"")
|
2015-12-28 05:00:10 +00:00
|
|
|
if(_err)
|
2015-12-29 12:23:08 +00:00
|
|
|
# Somehow the created file is not readable?
|
2015-12-28 05:00:10 +00:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
# Check if result file identical to source file
|
|
|
|
if(result_md5sum STREQUAL ${source_md5sum})
|
2018-03-15 21:34:26 +00:00
|
|
|
if (format MATCHES "lyx(1[0-9]|2[01])x")
|
|
|
|
# Do not compile, missing \origin statement prevents inclusion of
|
|
|
|
# files with relative path
|
|
|
|
message(STATUS "Not exporting due to missing \\origin statement")
|
|
|
|
break()
|
2019-04-08 14:39:50 +00:00
|
|
|
elseif(format MATCHES "lyx22x" AND file MATCHES "Minted")
|
|
|
|
message(STATUS "Not exporting due to missing minted support")
|
|
|
|
break()
|
2018-03-15 21:34:26 +00:00
|
|
|
endif()
|
2015-12-28 05:00:10 +00:00
|
|
|
message(STATUS "Source(${LYX_SOURCE}) and dest(${result_file_name}) are equal")
|
2018-03-15 21:34:26 +00:00
|
|
|
message(STATUS "Now try to export the lyx2lyx created file")
|
2024-09-17 16:42:46 +00:00
|
|
|
if (_export_format MATCHES "^pdf")
|
|
|
|
message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${_export_format} \"${result_file_name}.default\" \"${result_file_name}\"")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${_export_format} "${result_file_name}.default" "${result_file_name}"
|
|
|
|
RESULT_VARIABLE _err
|
|
|
|
ERROR_VARIABLE lyxerr)
|
|
|
|
Summary(_err "Test-compilation of \"${result_file_name}\" to format ${_export_format}")
|
|
|
|
endif()
|
2015-12-28 05:00:10 +00:00
|
|
|
break()
|
2018-01-22 13:43:50 +00:00
|
|
|
else()
|
2019-01-23 22:07:54 +00:00
|
|
|
list(APPEND _TestResultMessage "Warning: \"${LYX_SOURCE}\" and \"${result_file_name}\" differ")
|
2018-01-22 13:43:50 +00:00
|
|
|
message(STATUS "Source(${LYX_SOURCE}) and dest(${result_file_name}) are still different")
|
|
|
|
if (_lv GREATER 10)
|
2019-01-27 12:25:29 +00:00
|
|
|
set(_err 1)
|
|
|
|
message(STATUS "Possible endless loop encountered")
|
|
|
|
Summary(_err "Test-Loop exceeded the count of 10, Possible endless loop")
|
|
|
|
break()
|
2018-01-22 13:43:50 +00:00
|
|
|
endif()
|
2015-12-28 05:00:10 +00:00
|
|
|
endif()
|
|
|
|
set(source_md5sum ${result_md5sum})
|
|
|
|
set(LYX_SOURCE ${result_file_name})
|
|
|
|
endforeach()
|
|
|
|
else()
|
2016-10-12 12:35:23 +00:00
|
|
|
if ($ENV{LYX_DEBUG_LATEX})
|
2017-01-11 09:15:13 +00:00
|
|
|
set(LyXExtraParams -dbg latex)
|
2016-10-12 12:35:23 +00:00
|
|
|
else()
|
2020-08-05 10:54:36 +00:00
|
|
|
set(LyXExtraParams -dbg info)
|
2016-10-12 12:35:23 +00:00
|
|
|
endif()
|
2017-01-11 09:15:13 +00:00
|
|
|
if(IgnoreErrorMessage)
|
|
|
|
foreach (_em ${IgnoreErrorMessage})
|
|
|
|
list(APPEND LyXExtraParams --ignore-error-message ${_em})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
string(REGEX REPLACE ";" " " _LyXExtraParams "${LyXExtraParams}")
|
2020-11-16 11:40:35 +00:00
|
|
|
message(STATUS "Executing in working dir ${TempDir}")
|
2017-01-11 09:15:13 +00:00
|
|
|
message(STATUS "Executing ${lyx} ${_LyXExtraParams} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${result_file_name} \"${LYX_SOURCE}\"")
|
2020-11-16 11:22:33 +00:00
|
|
|
file(REMOVE "${TempDir}/${result_file_name}")
|
2015-12-28 05:00:10 +00:00
|
|
|
execute_process(
|
2017-01-11 09:15:13 +00:00
|
|
|
COMMAND ${lyx} ${LyXExtraParams} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${result_file_name} "${LYX_SOURCE}"
|
2020-11-16 11:22:33 +00:00
|
|
|
WORKING_DIRECTORY "${TempDir}"
|
2015-12-28 05:00:10 +00:00
|
|
|
RESULT_VARIABLE _err)
|
2019-01-27 12:25:29 +00:00
|
|
|
Summary(_err "Exporting \"${LYX_SOURCE}\" to format ${format}")
|
2015-12-28 05:00:10 +00:00
|
|
|
if (NOT _err)
|
2019-01-27 12:25:29 +00:00
|
|
|
#check if result file created
|
2020-11-16 11:22:33 +00:00
|
|
|
if (NOT EXISTS "${TempDir}/${result_file_name}")
|
|
|
|
message(STATUS "Expected result file \"${TempDir}/${result_file_name}\" does not exist")
|
2015-12-28 05:00:10 +00:00
|
|
|
set(_err -1)
|
2020-11-16 11:22:33 +00:00
|
|
|
Summary(_err "Expected result file \"${TempDir}/${result_file_name}\" does not exists")
|
2015-12-28 05:00:10 +00:00
|
|
|
else()
|
2020-11-16 11:22:33 +00:00
|
|
|
message(STATUS "Expected result file \"${TempDir}/${result_file_name}\" exists")
|
2020-07-20 14:55:28 +00:00
|
|
|
if (extension MATCHES "^x(ht)?ml$")
|
2023-01-08 16:12:16 +00:00
|
|
|
if (NOT format MATCHES "xhtml")
|
2020-09-20 09:47:04 +00:00
|
|
|
# Check with perl xml-parser
|
|
|
|
# needs XML::Parser module
|
2023-01-08 16:12:16 +00:00
|
|
|
check_xhtml_xmlparser(${result_file_name})
|
2020-09-20 09:47:04 +00:00
|
|
|
endif()
|
2023-01-08 16:12:16 +00:00
|
|
|
if (JAVA_EXECUTABLE)
|
|
|
|
if (format MATCHES "docbook5")
|
2023-01-09 03:19:51 +00:00
|
|
|
check_docbook_jing(${result_file_name})
|
2020-09-20 09:47:04 +00:00
|
|
|
else()
|
2023-01-27 02:40:23 +00:00
|
|
|
#check_xhtml_validate(${result_file_name})
|
2016-05-30 07:50:22 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2023-01-08 16:12:16 +00:00
|
|
|
if (XMLLINT_EXECUTABLE)
|
|
|
|
check_xhtml_xmllint(${result_file_name})
|
2020-10-10 20:18:16 +00:00
|
|
|
endif()
|
2016-05-30 07:50:22 +00:00
|
|
|
endif()
|
2015-12-28 05:00:10 +00:00
|
|
|
endif()
|
2015-12-25 09:28:40 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-12-02 23:23:07 +00:00
|
|
|
if(inverted)
|
2023-01-08 16:12:16 +00:00
|
|
|
string(COMPARE EQUAL ${NO_FAILES} 0 _erg)
|
2013-08-04 12:31:47 +00:00
|
|
|
else()
|
2023-01-08 16:12:16 +00:00
|
|
|
string(COMPARE NOTEQUAL ${NO_FAILES} 0 _erg)
|
2013-08-04 12:31:47 +00:00
|
|
|
endif()
|
2020-11-02 12:12:56 +00:00
|
|
|
|
|
|
|
if ($ENV{LYX_DEBUG_LATEX})
|
|
|
|
# Do not remove temporary files if one wants to examine them
|
|
|
|
# for example if setting the env-var LYX_DEBUG_LATEX
|
|
|
|
# This needs a remove all temp-dirs from time to time
|
|
|
|
# $ cd build-dir
|
|
|
|
# $ find autotests/out-home -name AbC_\* | xargs rm -rf
|
|
|
|
else()
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${TempDir}")
|
|
|
|
endif()
|
2019-01-23 22:07:54 +00:00
|
|
|
if(_TestResultMessage)
|
|
|
|
message(STATUS "Msg Summary:")
|
|
|
|
foreach(_l ${_TestResultMessage})
|
|
|
|
message(STATUS "\t${_l}")
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2013-01-21 01:36:42 +00:00
|
|
|
if(_erg)
|
2015-12-25 09:28:40 +00:00
|
|
|
message(STATUS "Exporting ${file}.lyx to ${format}")
|
2012-12-13 11:38:38 +00:00
|
|
|
message(FATAL_ERROR "Export failed")
|
|
|
|
endif()
|