From 8ac070afb082d92f7f64bf427b49396df1f541e4 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sun, 4 Aug 2013 14:31:47 +0200 Subject: [PATCH] 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. --- development/autotests/CMakeLists.txt | 22 +++++++++++-- development/autotests/export.cmake | 7 +++- development/autotests/revertedTests | 48 ++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 development/autotests/revertedTests diff --git a/development/autotests/CMakeLists.txt b/development/autotests/CMakeLists.txt index 1a7f711408..b2bb220524 100644 --- a/development/autotests/CMakeLists.txt +++ b/development/autotests/CMakeLists.txt @@ -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=$ @@ -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=$ + -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() diff --git a/development/autotests/export.cmake b/development/autotests/export.cmake index 75ef3d645b..dc5c0bf428 100755 --- a/development/autotests/export.cmake +++ b/development/autotests/export.cmake @@ -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) -string(COMPARE NOTEQUAL ${_err} 0 _erg) +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") diff --git a/development/autotests/revertedTests b/development/autotests/revertedTests new file mode 100644 index 0000000000..eb8d2d834f --- /dev/null +++ b/development/autotests/revertedTests @@ -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 -- 2.39.2