From: stevenknight Date: Mon, 6 Oct 2003 14:09:19 +0000 (+0000) Subject: Follow-on to TeX patch: add test cases for LaTeX and bibtex. (Sergey Fomel) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=00cb64634eb0ecfbf4bd6cfbd789a024b06d9e00;p=scons.git Follow-on to TeX patch: add test cases for LaTeX and bibtex. (Sergey Fomel) git-svn-id: http://scons.tigris.org/svn/scons/trunk@811 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 432d6247..440099f9 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -37,6 +37,11 @@ RELEASE X.XX - XXX - Add support for CCVERSION and CXXVERSION variables for a number of C and C++ compilers. + From Sergey Fogel: + + - Add test cases for the new capabilities to run bibtex and to rerun + latex as needed. + From Ralf W. Grosse-Kunstleve: - Accomodate anydbm modules that don't have a sync() method. diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index d1a8b095..c06efbf8 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -64,7 +64,7 @@ def LaTeXAuxAction(target = None, source= None, env=None): # Now if bibtex will need to be run. content = open(basename + ".aux","rb").read() if string.find(content, "bibdata") != -1: - bibfile = self.fs.File(basename) + bibfile = env.fs.File(basename) BibTeXAction(None,bibfile,env) # Now check if latex needs to be run yet again. for trial in range(3): diff --git a/test/TEX.py b/test/TEX.py index 888c209e..a2e69fa7 100644 --- a/test/TEX.py +++ b/test/TEX.py @@ -84,6 +84,8 @@ foo.DVI(target = 'foo.dvi', source = 'foo.tex') foo.DVI(target = 'foo-latex.dvi', source = 'foo-latex.tex') bar.DVI(target = 'bar', source = 'bar.tex') bar.DVI(target = 'bar-latex', source = 'bar-latex.tex') +foo.DVI('rerun.tex') +foo.DVI('bibtex-test.tex') """ % python) tex = r""" @@ -96,12 +98,51 @@ This is the %s TeX file. \begin{document} This is the %s LaTeX file. \end{document} +""" + + rerun = r""" +\documentclass{article} + +\begin{document} + +\LaTeX\ will need to run twice on this document to get a reference to section +\ref{sec}. + +\section{Next section} +\label{sec} + +\end{document} +""" + + bibtex = r""" +\documentclass{article} + +\begin{document} + +Run \texttt{latex}, then \texttt{bibtex}, then \texttt{latex} twice again \cite{lamport}. + +\bibliographystyle{plain} +\bibliography{test} + +\end{document} +""" + + bib = r""" +@Book{lamport, + author = {L. Lamport}, + title = {{\LaTeX: A} Document Preparation System}, + publisher = {Addison-Wesley}, + year = 1994 +} """ test.write('foo.tex', tex % 'foo.tex') test.write('bar.tex', tex % 'bar.tex') test.write('foo-latex.tex', latex % ('style', 'foo-latex.tex')) test.write('bar-latex.tex', latex % ('class', 'bar-latex.tex')) + test.write('rerun.tex', rerun) + test.write('bibtex-test.tex', bibtex) + test.write('test.bib', bib) test.run(arguments = 'foo.dvi foo-latex.dvi', stderr = None) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) @@ -113,4 +154,11 @@ This is the %s LaTeX file. test.fail_test(not os.path.exists(test.workpath('bar.dvi'))) test.fail_test(not os.path.exists(test.workpath('bar-latex.dvi'))) + test.run(stderr = None) + output_lines = string.split(test.stdout(), '\n') + reruns = filter(lambda x: x == 'latex rerun.tex', output_lines) + test.fail_test(len(reruns) != 2) + bibtex = filter(lambda x: x == 'bibtex bibtex-test', output_lines) + test.fail_test(len(bibtex) != 1) + test.pass_test()