mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Cmake tests: Get rid of use of command 'env', which is not available under Windows.
This commit is contained in:
parent
4f396c3364
commit
e430586ec3
@ -38,11 +38,11 @@ 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" "Input ${bns}\n")
|
||||
add_test(NAME "check_layout/${bns}"
|
||||
COMMAND env LYX_USERDIR_22x=${LYX_TESTS_USERDIR} $<TARGET_FILE:check_layout> "${LYX_TESTS_USERDIR}/layouts/test${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
|
||||
COMMAND $<TARGET_FILE:check_layout> "${LYX_TESTS_USERDIR}/layouts/test${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
|
||||
set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
|
||||
else()
|
||||
add_test(NAME "check_layout/${bns}"
|
||||
COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
|
||||
|
@ -64,8 +64,11 @@ add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
|
||||
add_custom_command(
|
||||
OUTPUT LyxTestFiles
|
||||
COMMAND ${CMAKE_COMMAND} -E touch LyxTestFiles
|
||||
COMMAND env LYX_USERDIR_VER=${LYX_USERDIR_VER}
|
||||
${LYX_PYTHON_EXECUTABLE} "${runtestsScript}" $<TARGET_FILE:${_tex2lyx}> "${scriptDir}" "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DENVIRON="${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR}"
|
||||
-DCOMMAND="${LYX_PYTHON_EXECUTABLE}"
|
||||
-DPARAMS="${runtestsScript}'$<TARGET_FILE:${_tex2lyx}>'${scriptDir}'${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
-P ${TOP_SRC_DIR}/src/tex2lyx/test/env_custom_command.cmake
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPENDS ${_tex2lyx} ${_lyx}
|
||||
)
|
||||
|
40
src/tex2lyx/test/env_custom_command.cmake
Normal file
40
src/tex2lyx/test/env_custom_command.cmake
Normal file
@ -0,0 +1,40 @@
|
||||
# This file is part of LyX, the document processor.
|
||||
# Licence details can be found in the file COPYING.
|
||||
#
|
||||
# Copyright (c) 2015 Kornel Benko <kornel@lyx.org>
|
||||
#
|
||||
# Environ and parameter strings are separated by "'"
|
||||
# Script should be called like:
|
||||
# add_custom_command(
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# -DENVIRON="${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR}" \
|
||||
# -DCOMMAND="${LYX_PYTHON_EXECUTABLE}" \
|
||||
# -DPARAMS="${runtestsScript}'$<TARGET_FILE:${_tex2lyx}>'${scriptDir}'${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
# -P ${TOP_SRC_DIR}/src/tex2lyx/test/env_custom_command.cmake
|
||||
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
# DEPENDS ...
|
||||
# )
|
||||
|
||||
string(REGEX MATCHALL "[^']+" ENVIRON_LIST "${ENVIRON}")
|
||||
foreach(_env ${ENVIRON_LIST})
|
||||
if (_env MATCHES "^\([^=]+\)=\(.*\)$")
|
||||
set(ENV{${CMAKE_MATCH_1}} ${CMAKE_MATCH_2})
|
||||
#message(STATUS "setting env ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}")
|
||||
else()
|
||||
message(FATAL_ERROR "Wrong environment string \"${_env}\"")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
string(REGEX MATCHALL "[^']+" parameters "${PARAMS}")
|
||||
execute_process(COMMAND "${COMMAND}" ${parameters}
|
||||
RESULT_VARIABLE _err
|
||||
OUTPUT_VARIABLE _out)
|
||||
|
||||
message(STATUS ${_out})
|
||||
#message(STATUS "Error output of \"${COMMAND}\" " ${parameters} " = ${_err}")
|
||||
string(COMPARE NOTEQUAL ${_err} 0 _erg)
|
||||
|
||||
if(_erg)
|
||||
message(FATAL_ERROR "\"${COMMAND}\" ${parameters} failed")
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user