2 # -*- coding: utf-8 -*-
4 # file src/tex2lyx/test/runtests.py
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
10 # Full author contact details are available in file CREDITS
12 # This script is a very basic test suite runner for tex2lyx
13 # The defaults for optional command line arguments are tailored to the
14 # standard use case of testing without special build settings like a version
15 # suffix, since I don't know how to transport command line arguments through
16 # the autotools "make check" mechanism.
18 import os, string, sys
22 return "Usage: %s [<tex2lyx binary> [<script dir>] [<output dir>]]" % prog_name
26 # Parse and manipulate the command line arguments.
28 sys.path.append(os.path.join(sys.argv[2]))
30 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../../lib/scripts'))
32 from lyxpreview_tools import error
41 inputdir = os.path.dirname(argv[0])
43 outputdir = sys.argv[3]
46 # outputdir = os.path.join(os.path.dirname(tex2lyx), "test")
48 files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
49 'box-color-size-space-align.tex', 'CJK.tex', \
50 'XeTeX-polyglossia.tex']
54 texfile = os.path.join(inputdir, f)
55 if outputdir == inputdir:
56 cmd = '%s -roundtrip -f %s' % (tex2lyx, texfile)
58 lyxfile = os.path.join(outputdir, f)
59 cmd = '%s -roundtrip -copyfiles -f %s %s' % (tex2lyx, texfile, lyxfile)
60 if os.system(cmd) != 0:
64 error('Converting the following files failed: %s' % ', '.join(errors))
66 if __name__ == "__main__":