mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Split roundtrip tests (at least on cmake build)
to show better grained output
This commit is contained in:
parent
471fdcd9d0
commit
2b66f1b1ac
@ -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
|
||||
|
||||
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)
|
||||
|
||||
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}")
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${_fl})
|
||||
set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES DEPENDS tex2lyx/create_tex2lyx)
|
||||
endforeach()
|
||||
|
||||
set_tests_properties(tex2lyx/create_tex2lyx PROPERTIES DEPENDS tex2lyx/create_lyx)
|
||||
set_tests_properties(tex2lyx/roundtrip PROPERTIES DEPENDS tex2lyx/create_tex2lyx)
|
||||
|
||||
|
@ -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,6 +45,9 @@ def main(argv):
|
||||
# outputdir = inputdir
|
||||
outputdir = os.path.join(os.path.dirname(tex2lyx), "test")
|
||||
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user