Check_layout tests: Check also stderr

1.) The command check_layout exits with "0", even if the module contains errors.
  The new module check_layout.cmake tries to compensate.
2.) Added default style to the test layouts when checking single modules.
This commit is contained in:
Kornel Benko 2017-04-13 11:18:05 +02:00
parent db494452dc
commit fab6ee2f4d
2 changed files with 36 additions and 2 deletions

View File

@ -38,10 +38,18 @@ foreach(bns ${layout_files} ${module_files})
if("${_checktype}" STREQUAL "module")
file(WRITE "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#% Do not delete the line below; configure depends on this\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "# \\DeclareLaTeXClass{test${bn}}\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 55\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 63\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Style Standard\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " LabelType No_Label\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " Category MainText\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "End\n")
file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
add_test(NAME "check_layout/${bns}"
COMMAND $<TARGET_FILE:check_layout> "${LYX_TESTS_USERDIR}/layouts/test${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
COMMAND ${CMAKE_COMMAND}
"-DCheckLayout=$<TARGET_FILE:check_layout>"
"-DModule=${LYX_TESTS_USERDIR}/layouts/test${bn}"
"-DOutput=${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}"
-P "${TOP_SRC_DIR}/src/tests/check_layout.cmake")
set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
else()
add_test(NAME "check_layout/${bns}"

View File

@ -0,0 +1,26 @@
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
#
# Copyright (c) 2017 Kornel Benko kornel@lyx.org
# Should be called like
# cmake -DCheckLayout=$<TARGET_FILE:check_layout>
# -DModule="${LYX_TESTS_USERDIR}/layouts/test${bn}"
# -DOutput="${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}"
# -P "${TOP_SRC_DIR}/src/tests/check_layout.cmake"
execute_process(COMMAND ${CheckLayout} ${Module} ${Output}
OUTPUT_VARIABLE _out
ERROR_VARIABLE _err
RESULT_VARIABLE _erg)
#message(STATUS "_out = \"${_out}\"")
string(COMPARE EQUAL ${_erg} 0 _erg1)
if(NOT _erg1)
message(STATUS "_erg = \"${_erg}\"")
message(FATAL_ERROR "${CheckLayout} failed")
endif()
if (_err MATCHES "Error reading")
message(STATUS "_err = \"${_err}\"")
message(FATAL_ERROR "Errors found")
endif()