The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 892e237fe1c5d7574b08d017070262239465f70b
Author: Kornel Benko <[email protected]>
Date:   Sat Dec 15 00:15:59 2012 +0100

    Cmake build: Testing
    Make this all more the cmake way

diff --git a/development/autotests/CMakeLists.txt 
b/development/autotests/CMakeLists.txt
index 7d9a5da..3901ffd 100644
--- a/development/autotests/CMakeLists.txt
+++ b/development/autotests/CMakeLists.txt
@@ -30,7 +30,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 autotests/${_t}
        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
        COMMAND ${CMAKE_COMMAND}
         -DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
@@ -50,7 +50,7 @@ file(GLOB lyx_files RELATIVE "${TOP_SRC_DIR}/lib/doc" 
"${TOP_SRC_DIR}/lib/doc/*.
 foreach(f ${lyx_files})
   # Strip extension
   string(REGEX REPLACE "\\.lyx$" "" f ${f})
-  add_test(NAME autotests/export_${f}_lyx16
+  add_test(NAME autotests/export/${f}_lyx16
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
     COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${TOP_SRC_DIR}/lib/doc
             -Dlyx=$<TARGET_FILE:${_lyx}>
@@ -58,7 +58,7 @@ foreach(f ${lyx_files})
            -Dextension=16.lyx
            -Dfile=${f}
            -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
-  add_test(NAME autotests/export_${f}_xhtml
+  add_test(NAME autotests/export/${f}_xhtml
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
     COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${TOP_SRC_DIR}/lib/doc
             -Dlyx=$<TARGET_FILE:${_lyx}>
diff --git a/src/support/tests/CMakeLists.txt b/src/support/tests/CMakeLists.txt
index 8452e08..4f6f3a1 100644
--- a/src/support/tests/CMakeLists.txt
+++ b/src/support/tests/CMakeLists.txt
@@ -38,14 +38,11 @@ foreach(_src ${check_PROGRAMS})
        string(REPLACE "check_" "" _srcx ${_src})
        set(src_data_file "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}")
        set(created_data_file 
"${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}_data")
-        add_test(NAME support/${_srcx}/build
-         COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target 
${_src})
-       add_test(NAME support/${_srcx}/createdata
-         COMMAND ${_src} > "${created_data_file}")
-       add_test(NAME support/${_srcx}/compare
-         COMMAND ${CMAKE_COMMAND} -E compare_files "${src_data_file}" 
"${created_data_file}")
-       set_tests_properties(support/${_srcx}/createdata PROPERTIES DEPENDS 
support/${_srcx}/build )
-       set_tests_properties(support/${_srcx}/compare PROPERTIES DEPENDS 
support/${_srcx}/createdata)
+        add_test(NAME support/${_srcx}
+          COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:${_src}>
+                                   -DInput=${src_data_file}
+                                   -DOutput=${created_data_file}
+                                   -P 
"${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
 endforeach()
 
 
diff --git a/src/support/tests/supporttest.cmake 
b/src/support/tests/supporttest.cmake
new file mode 100644
index 0000000..829f588
--- /dev/null
+++ b/src/support/tests/supporttest.cmake
@@ -0,0 +1,30 @@
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# Copyright (c) 2012 Kornel Benko [email protected]
+#
+#
+# Script should be called like:
+# cmake -DCommand=xxx \
+#       -DInput=xxx \
+#       -DOutput=xxx \
+#       -P xxxx/supporttest.cmake
+#
+# 
+# Command: The executable, whose output is to be examined
+# Input: The file name of expected data
+# Output: The file name for data catched from output of the executable
+
+execute_process(COMMAND "${Command}"
+  OUTPUT_FILE "${Output}"
+  RESULT_VARIABLE _testres)
+
+if(_testres)
+  message(FATAL_ERROR "${Command} not working")
+endif()
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files "${Input}" 
"${Output}"
+                RESULT_VARIABLE _testres)
+if(_testres)
+  message(FATAL_ERROR "Files are not eqal")
+endif()
diff --git a/src/tex2lyx/test/CMakeLists.txt b/src/tex2lyx/test/CMakeLists.txt
index b233bdd..ae2037a 100644
--- a/src/tex2lyx/test/CMakeLists.txt
+++ b/src/tex2lyx/test/CMakeLists.txt
@@ -7,26 +7,18 @@
 project(test)
 
 file(GLOB _tex_tests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" 
"${CMAKE_CURRENT_SOURCE_DIR}/*.ltx" "${CMAKE_CURRENT_SOURCE_DIR}/*.tex")
-#set(_tex_tests test.ltx test-structure test-insets test-modules 
box-color-size-space-align CJK XeTeX-polyglossia)
-list(REMOVE_ITEM _tex_tests DummyDocument.tex)
-
-add_test(NAME tex2lyx/create_lyx
-  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_lyx})
 
-add_test(NAME tex2lyx/create_tex2lyx
-  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_tex2lyx})
-set_tests_properties(tex2lyx/create_tex2lyx PROPERTIES DEPENDS 
tex2lyx/create_lyx)
+list(REMOVE_ITEM _tex_tests DummyDocument.tex)
 
 foreach(_fl ${_tex_tests})
   set(fl ${_fl})
   add_test(NAME tex2lyx/roundtrip/${_fl}
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
     COMMAND ${LYX_PYTHON_EXECUTABLE} 
"${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py"
-    "${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${_tex2lyx}"
+    "$<TARGET_FILE:${_tex2lyx}>"
     "${TOP_SRC_DIR}/lib/scripts"
     "${CMAKE_CURRENT_BINARY_DIR}"
     ${fl})
-  set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES DEPENDS 
tex2lyx/create_tex2lyx)
 endforeach()
 
 

-----------------------------------------------------------------------

Summary of changes:
 development/autotests/CMakeLists.txt |    6 +++---
 src/support/tests/CMakeLists.txt     |   13 +++++--------
 src/support/tests/supporttest.cmake  |   30 ++++++++++++++++++++++++++++++
 src/tex2lyx/test/CMakeLists.txt      |   12 ++----------
 4 files changed, 40 insertions(+), 21 deletions(-)
 create mode 100644 src/support/tests/supporttest.cmake


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to