Cmake export tests

Some export test are known to fail. Checking them every time is cumbersome.
Now, the tests marked in file revertedTests will invert the success condition
and mark the test as INVERTED_SEE-README.ctest.

If some of the tests in revertedTests fails, this is good, and the testname
can be removed from it.
This commit is contained in:
Kornel Benko 2013-08-04 14:31:47 +02:00
parent efe2c681b5
commit 8ac070afb0
3 changed files with 74 additions and 3 deletions

View File

@ -115,6 +115,16 @@ macro(getoutputformats filepath varname)
endforeach()
endmacro()
macro(getreverted testname reverted listreverted)
list(FIND ${listreverted} ${${testname}} _idx)
if (${_idx} LESS 0)
set(${reverted} 0)
else()
set(${reverted} 1)
set(${testname} "INVERTED_SEE-README.ctest_${${testname}}")
endif()
endmacro()
foreach(libsubfolder doc examples templates)
set(LIBSUB_SRC_DIR "${TOP_SRC_DIR}/lib/${libsubfolder}")
file(GLOB_RECURSE lyx_files RELATIVE "${LIBSUB_SRC_DIR}" "${LIBSUB_SRC_DIR}/*.lyx")
@ -130,10 +140,13 @@ foreach(libsubfolder doc examples templates)
list(APPEND nolang_lyx_files ${f})
endif()
endforeach()
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/revertedTests" revertedTests)
foreach(f ${nolang_lyx_files} ${lang_lyx_files})
# Strip extension
string(REGEX REPLACE "\\.lyx$" "" f ${f})
add_test(NAME export/${libsubfolder}/${f}_lyx16
set(TestName "export/${libsubfolder}/${f}_lyx16")
getreverted(TestName reverted revertedTests)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
-Dlyx=$<TARGET_FILE:${_lyx}>
@ -141,16 +154,21 @@ foreach(libsubfolder doc examples templates)
-Dformat=lyx16x
-Dextension=16.lyx
-Dfile=${f}
-Dreverted=${reverted}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
foreach(format ${formatlist})
add_test(NAME export/${libsubfolder}/${f}_${format}
set(TestName "export/${libsubfolder}/${f}_${format}")
getreverted(TestName reverted revertedTests)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
-Dlyx=$<TARGET_FILE:${_lyx}>
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-Dformat=${format}
-Dextension=${format}
-Dfile=${f}
-Dreverted=${reverted}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
endforeach()
endforeach()

View File

@ -17,6 +17,7 @@
# -Dformat=xxx \
# -Dextension=xxx \
# -Dfile=xxx \
# -Dreverted=[01] \
# -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
#
@ -26,7 +27,11 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
execute_process(
COMMAND ${lyx} -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"
RESULT_VARIABLE _err)
if(reverted)
string(COMPARE EQUAL ${_err} 0 _erg)
else()
string(COMPARE NOTEQUAL ${_err} 0 _erg)
endif()
if(_erg)
message(STATUS "Exporting ${f}.lyx to ${format}")
message(FATAL_ERROR "Export failed")

View File

@ -0,0 +1,48 @@
export/doc/he/Intro_pdf
export/doc/he/Intro_pdf2
export/doc/he/Intro_pdf5
export/doc/he/Tutorial_pdf
export/doc/he/Tutorial_pdf2
export/doc/he/Tutorial_pdf5
export/doc/hu/Intro_pdf5
export/doc/id/Intro_pdf5
export/doc/id/Shortcuts_pdf5
export/doc/id/Tutorial_pdf5
export/doc/id/UserGuide_pdf5
export/doc/ja/Additional_pdf3
export/doc/ja/Customization_pdf3
export/doc/ja/EmbeddedObjects_pdf
export/doc/ja/EmbeddedObjects_pdf2
export/doc/ja/EmbeddedObjects_pdf5
export/doc/ja/Intro_pdf3
export/doc/ja/Tutorial_pdf3
export/doc/ja/UserGuide_pdf
export/doc/ja/UserGuide_pdf2
export/doc/ja/UserGuide_pdf5
export/doc/zh_CN/Intro_pdf5
export/doc/zh_CN/Tutorial_pdf5
export/examples/Literate_pdf
export/examples/Literate_pdf2
export/examples/Literate_pdf5
export/examples/aa_sample_pdf
export/examples/aa_sample_pdf2
export/examples/aa_sample_pdf5
export/examples/listerrors_pdf
export/examples/noweb2lyx_pdf
export/examples/noweb2lyx_pdf2
export/examples/noweb2lyx_pdf5
export/examples/es/europeCV_pdf5
export/examples/fa/splash_pdf5
export/examples/he/example_lyxified_pdf
export/examples/he/example_lyxified_pdf2
export/examples/he/example_lyxified_pdf5
export/examples/he/example_raw_pdf
export/examples/he/example_raw_pdf2
export/examples/he/example_raw_pdf5
export/examples/he/splash_pdf
export/examples/he/splash_pdf2
export/examples/he/splash_pdf5
export/examples/hu/example_lyxified_pdf5
export/examples/hu/example_raw_pdf5
export/examples/hu/splash_pdf5
export/examples/id/splash_pdf5