The branch, master, has been updated.

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

commit 2b66f1b1aca8661d9aca0adca1f5db769c8dc9eb
Author: Kornel Benko <kor...@lyx.org>
Date:   Fri Dec 14 19:07:28 2012 +0100

    Split roundtrip tests (at least on cmake build)
    to show better grained output

diff --git a/src/tex2lyx/test/CMakeLists.txt b/src/tex2lyx/test/CMakeLists.txt
index 9f28120..ff90d11 100644
--- a/src/tex2lyx/test/CMakeLists.txt
+++ b/src/tex2lyx/test/CMakeLists.txt
@@ -19,7 +19,7 @@ ADD_CUSTOM_COMMAND(
   OUTPUT ${_test_output}
   COMMAND ${LYX_PYTHON_EXECUTABLE}
   ARGS "${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}"
   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
@@ -32,17 +32,22 @@ ADD_CUSTOM_COMMAND(
 
 #ADD_CUSTOM_TARGET(test DEPENDS ${_tex2lyx} ${_lyx} ${_test_output})
 
-add_test(NAME tex2lyx/create_tex2lyx
-  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_tex2lyx})
 add_test(NAME tex2lyx/create_lyx
   COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_lyx})
-add_test(NAME tex2lyx/roundtrip
-  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}"
-  "${TOP_SRC_DIR}/lib/scripts"
-  "${CMAKE_CURRENT_BINARY_DIR}")
 
+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)
-set_tests_properties(tex2lyx/roundtrip PROPERTIES DEPENDS 
tex2lyx/create_tex2lyx)
+
+foreach(_fl test.ltx test-structure.tex test-insets.tex test-modules.tex 
box-color-size-space-align.tex CJK.tex XeTeX-polyglossia.tex)
+  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}"
+    "${TOP_SRC_DIR}/lib/scripts"
+    "${CMAKE_CURRENT_BINARY_DIR}"
+    ${_fl})
+  set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES DEPENDS 
tex2lyx/create_tex2lyx)
+endforeach()
+
 
diff --git a/src/tex2lyx/test/runtests.py b/src/tex2lyx/test/runtests.py
index 13d62f6..94132a0 100755
--- a/src/tex2lyx/test/runtests.py
+++ b/src/tex2lyx/test/runtests.py
@@ -15,11 +15,10 @@
 # suffix, since I don't know how to transport command line arguments through
 # the autotools "make check" mechanism.
 
-import os, string, sys, time, difflib, filecmp
-
+import os, string, sys, time, difflib, filecmp, subprocess, re
 
 def usage(prog_name):
-  return "Usage: %s [<tex2lyx binary> [<script dir>] [<output dir>]]" % 
prog_name
+  return "Usage: %s [<tex2lyx binary> [[<script dir>] [[<output dir>] 
[testfile]]]]" % prog_name
 
 
 def main(argv):
@@ -33,11 +32,12 @@ def main(argv):
 
     if len(argv) < 2:
         tex2lyx = './tex2lyx'
-    elif len(argv) <= 4:
+    elif len(argv) <= 5:
         tex2lyx = argv[1]
     else:
         error(usage(argv[0]))
 
+    lyx = os.path.join(os.path.dirname(tex2lyx), "lyx")
     inputdir = os.path.dirname(argv[0])
     if len(argv) >= 4:
         outputdir = sys.argv[3]
@@ -45,7 +45,10 @@ def main(argv):
 #        outputdir = inputdir
         outputdir = os.path.join(os.path.dirname(tex2lyx), "test")
 
-    files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
+    if len(argv) >= 5:
+        files = [sys.argv[4]]
+    else:
+        files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
              'test-modules.tex', 'box-color-size-space-align.tex', \
              'CJK.tex', 'XeTeX-polyglossia.tex']
 
@@ -59,7 +62,17 @@ def main(argv):
         else:
             lyxfile = os.path.join(outputdir, base + ".lyx")
             cmd = '%s -roundtrip -copyfiles -f %s %s' % (tex2lyx, texfile, 
lyxfile)
-        if os.system(cmd) != 0:
+        proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
+        proc.wait()
+        err = proc.returncode
+        errorstring = proc.stderr.read()
+        if not errorstring is None:
+            print errorstring
+            if err == 0:
+                matchObj = re.match(r'.*: +Error +in +.*', errorstring, 
re.M|re.S)
+                if matchObj:
+                    err = 9999
+        if err != 0:
             errors.append(f)
         elif not overwrite:
             lyxfile1 = os.path.join(inputdir, base + ".lyx.lyx")

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

Summary of changes:
 src/tex2lyx/test/CMakeLists.txt |   25 +++++++++++++++----------
 src/tex2lyx/test/runtests.py    |   25 +++++++++++++++++++------
 2 files changed, 34 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to