]> git.lyx.org Git - features.git/commitdiff
Cmake build: modify some tests
authorKornel Benko <kornel@lyx.org>
Wed, 21 Aug 2013 11:34:26 +0000 (13:34 +0200)
committerKornel Benko <kornel@lyx.org>
Wed, 21 Aug 2013 11:34:26 +0000 (13:34 +0200)
a) test export/templates/ectaart_pdf5 removed, because
    of incompatibility between ectart.cls and luatex.sty
b) renamed some tests to reflect their purpose
    tex2lyx2lyx/roundtrip/ => tex2lyx/cmplyx/
          # the tests are comparing files written by lyx (not by tex2lyx)
    autotests/ => keytest/
          # we are testing reactions of lyx to some key strokes
c) add tests for lyx2lyx. This is rather rudimental, in that it only
    checks for created output, error codes and error output.
d) use correct environment variable to set up the userdir for testing

development/autotests/CMakeLists.txt
development/autotests/export.cmake
development/autotests/ignoredTests [new file with mode: 0644]
development/autotests/lyx2lyxtest.cmake [new file with mode: 0755]
development/autotests/single-test.cmake

index ecb49b59fc9728a15f4fd4e527cfbe97eeea6631..011e8e8672813dce58dc25240135c435288d97b5 100644 (file)
@@ -60,11 +60,11 @@ if(Q_WS_X11)
 
   if(Missing)
     message(STATUS "Missing Libraries or programs to create xvkbd: ${Missing}")
-    message(STATUS "cmake build is therefore omitting autotests")
+    message(STATUS "cmake build is therefore omitting keytests")
   endif()
 
   if(NOT Missing)
-    project(autotests)
+    project(keytest)
 
     add_subdirectory(xvkbd)
 
@@ -80,7 +80,7 @@ if(Q_WS_X11)
 
     foreach(_tf first-time-in.txt hello-world-in.txt ${TESTST})
       string(REGEX REPLACE "-in\\.(txt|sh)" "" _t ${_tf})
-      add_test(NAME autotests/${_t}
+      add_test(NAME keytest/${_t}
         WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
         COMMAND ${CMAKE_COMMAND}
         -DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
@@ -89,6 +89,7 @@ if(Q_WS_X11)
         -DBINDIR=$<TARGET_FILE_DIR:${_lyx}>
         -DLYX=${_lyx}
         -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
+        -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
         -DKEYTEST_OUTFILE=${_t}-out.txt
         -DPACKAGE=${PACKAGE}
         -DLOCALE_DIR=${LOCALE_DIR}
@@ -142,6 +143,7 @@ foreach(libsubfolder doc examples templates)
     endif()
   endforeach()
   file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/revertedTests" revertedTests)
+  file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/ignoredTests" ignoredTests)
   foreach(f ${nolang_lyx_files} ${lang_lyx_files})
     # Strip extension
     string(REGEX REPLACE "\\.lyx$" "" f ${f})
@@ -152,18 +154,28 @@ foreach(libsubfolder doc examples templates)
       COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
           -Dlyx=$<TARGET_FILE:${_lyx}>
           -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
+          -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
           -Dformat=lyx16x
           -Dextension=16.lyx
           -Dfile=${f}
           -Dreverted=${reverted}
           -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
+    set(TestName "lyx2lyx/${libsubfolder}/${f}")
+    getreverted(TestName reverted revertedTests)
+    add_test(NAME ${TestName}
+      WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
+      COMMAND ${CMAKE_COMMAND} -DLYX2LYX=${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
+        -DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
+        -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
     getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
     foreach(format ${formatlist})
       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}
+      list(FIND ignoredTests ${TestName} _idx)
+      if (${_idx} LESS 0)
+        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}
@@ -171,6 +183,7 @@ foreach(libsubfolder doc examples templates)
             -Dfile=${f}
             -Dreverted=${reverted}
             -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
+      endif()
     endforeach()
   endforeach()
 endforeach()
index dc5c0bf428948f24787239a58e1fc80fe0c3c52e..6fb919c1235548b7cf474e38a30d88821494bf31 100755 (executable)
@@ -5,6 +5,7 @@
 #
 #
 # LYX_ROOT  = ${TOP_SRC_DIR}/lib/{doc,examples,templates}
+# LYX_USERDIR_VER = Name of environment variable for the user directory
 # lyx       = 
 # format    = lyx16x|xhtml
 # extension = 16.lyx|xhtml
@@ -12,7 +13,8 @@
 #
 # Script should be called like:
 # cmake -DLYX_ROOT=xxx \
-#       -DWORKDIR=${BUILD_DIR}/autotests/out-home
+#       -DWORKDIR=${BUILD_DIR}/autotests/out-home \
+#       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
 #       -Dlyx=xxx \
 #       -Dformat=xxx \
 #       -Dextension=xxx \
@@ -22,7 +24,7 @@
 #
 
 message(STATUS "Executing ${lyx} -E ${format} ${file}.${extension} ${LYX_ROOT}/${file}.lyx")
-set(ENV{LYX_USERDIR} "${WORKDIR}/.lyx")
+set(ENV{${LYX_USERDIR_VER}} "${WORKDIR}/.lyx")
 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
 execute_process(
   COMMAND ${lyx} -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"
diff --git a/development/autotests/ignoredTests b/development/autotests/ignoredTests
new file mode 100644 (file)
index 0000000..dbfb39a
--- /dev/null
@@ -0,0 +1 @@
+export/templates/ectaart_pdf5
diff --git a/development/autotests/lyx2lyxtest.cmake b/development/autotests/lyx2lyxtest.cmake
new file mode 100755 (executable)
index 0000000..e595fc3
--- /dev/null
@@ -0,0 +1,43 @@
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# Copyright (c) 2013 Kornel Benko kornel@lyx.org
+#
+#
+# LYX2LYX  = ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
+# LYXFILE  = xxx
+#
+# Script should be called like:
+# cmake -DLYX2LYX=xxx \
+#       -DWORKDIR=${BUILD_DIR}/autotests/out-home \
+#       -DLYXFILE=xxx \
+#       -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
+#
+
+message(STATUS "Executing ${LYX2LYX} -e errors -o output ${LYXFILE}")
+execute_process(
+  COMMAND ${LYX2LYX} -e errors -o output ${LYXFILE}
+  RESULT_VARIABLE _err)
+
+message(STATUS "Error output of lyx2lyx = ${_err}")
+string(COMPARE NOTEQUAL  ${_err} 0 _erg)
+
+# Check file "errors" being empty
+file(STRINGS "errors" foundErrors)
+if(foundErrors)
+  set(_erg 1)
+  foreach(_l ${foundErrors})
+    message(STATUS "${_l}")
+  endforeach()
+endif()
+
+# Check file "output" being not empty
+file(STRINGS "output" createdLyx)
+if(NOT createdLyx)
+  set(_erg 1)
+  message(STATUS "Created file empty")
+endif()
+
+if(_erg)
+  message(FATAL_ERROR "lyx2lyx failed")
+endif()
index 3f452cc5c7ed3c79deea36c7e220c72e0937c263..ecb8fbbcc9fc8ce59839a15dade1acb7a49a3899 100755 (executable)
@@ -6,6 +6,7 @@
 # KEYTEST_OUTFILE = xxx-out.txt
 # BINDIR          = ${BUILD_DIR}/bin
 # WORKDIR         = ${BUILD_DIR}/autotests/out-home
+# LYX_USERDIR_VER = ${LYX_USERDIR_VER}
 # LOCALE_DIR      = ${BUILD_DIR}/autotests/locale
 # PO_BUILD_DIR    = ${BUILD_DIR}/po
 # PACKAGE         = lyx2.1
@@ -17,6 +18,7 @@
 #       -DBINDIR=xxx \
 #       -DLYX=xxx \
 #       -DWORKDIR=xxx \
+#       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
 #       -DLOCALE_DIR=xxx \
 #       -DPO_BUILD_DIR=xxx \
 #       -DPACKAGE=xxx \
@@ -46,8 +48,25 @@ else()
 endif()
 
 set(LYX_EXE "${BINDIR}/${LYX}")
-set(XVKBD_EXE "${BINDIR}/xvkbd")
-set(ENV{XVKBD_HACKED} "1")
+set(use_hacked $ENV{XVKBD_HACKED})
+if(NOT use_hacked)
+  if(use_hacked STREQUAL "")
+    # ENV{XVKBD_HACKED} probably not set, so the default should be
+    # to use the hacked
+    set(use_hacked "1")
+  else()
+    set(use_hacked "0")
+  endif()
+else()
+  set(use_hacked "1")
+endif()
+
+set(ENV{XVKBD_HACKED} ${use_hacked})
+if(use_hacked)
+  set(XVKBD_EXE "${BINDIR}/xvkbd")
+else()
+  set(XVKBD_EXE "/usr/bin/xvkbd")
+endif()
 
 if(EXISTS "${WORKDIR}/.lyx/session")
   execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${WORKDIR}/.lyx/session")
@@ -56,7 +75,7 @@ endif()
 set(ENV{PACKAGE} ${PACKAGE})
 set(ENV{LOCALE_DIR} ${LOCALE_DIR})
 set(ENV{LYX_LOCALEDIR} "${WORKDIR}/../locale")
-set(ENV{LYX_USERDIR} "${WORKDIR}/.lyx")
+set(ENV{${LYX_USERDIR_VER}} "${WORKDIR}/.lyx")
 set(ENV{LYX_PID} ${pidres})
 set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
 set(ENV{LYX_EXE} ${LYX_EXE})