summaryrefslogtreecommitdiffstats
path: root/test/TEX
diff options
context:
space:
mode:
authorRobert Managan <managan1@llnl.gov>2009-07-22 04:56:52 (GMT)
committerRobert Managan <managan1@llnl.gov>2009-07-22 04:56:52 (GMT)
commit069ce5a194b250c09667606c2e926747f5f083aa (patch)
treee68c1126b8e261b55abe10e78067c59554330a8d /test/TEX
parent9915e5215af5dc08f58cfc91f08aabc1b8ae2cd5 (diff)
downloadSCons-069ce5a194b250c09667606c2e926747f5f083aa.zip
SCons-069ce5a194b250c09667606c2e926747f5f083aa.tar.gz
SCons-069ce5a194b250c09667606c2e926747f5f083aa.tar.bz2
Update tex builder to use the -recorder option.
This was prompted because MikTeX, used on Windows, does not put the same information on files opened into the log file. The -recorder option gives a .fls file that is the same on all platforms. We still use the .log file contents to find warnings and errors that mean we need to rerun latex... Also add message about errors so user does not have to scroll up through all the latex output to find if there was an error. Update all tests to handle the new command line option. Add one more test on grpahics conversion.
Diffstat (limited to 'test/TEX')
-rw-r--r--test/TEX/LATEX.py2
-rw-r--r--test/TEX/PDFLATEX.py2
-rw-r--r--test/TEX/PDFTEX.py2
-rw-r--r--test/TEX/TEX.py4
-rw-r--r--test/TEX/dryrun.py2
-rw-r--r--test/TEX/eps_graphics2.py188
6 files changed, 194 insertions, 6 deletions
diff --git a/test/TEX/LATEX.py b/test/TEX/LATEX.py
index fff98df..2316770 100644
--- a/test/TEX/LATEX.py
+++ b/test/TEX/LATEX.py
@@ -44,7 +44,7 @@ test.write('mylatex.py', r"""
import sys
import os
import getopt
-cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', [])
+cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', [])
base_name = os.path.splitext(arg[0])[0]
infile = open(arg[0], 'rb')
dvi_file = open(base_name+'.dvi', 'wb')
diff --git a/test/TEX/PDFLATEX.py b/test/TEX/PDFLATEX.py
index a7e68aa..a7320a1 100644
--- a/test/TEX/PDFLATEX.py
+++ b/test/TEX/PDFLATEX.py
@@ -44,7 +44,7 @@ test.write('mypdflatex.py', r"""
import sys
import os
import getopt
-cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', [])
+cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', [])
base_name = os.path.splitext(arg[0])[0]
infile = open(arg[0], 'rb')
pdf_file = open(base_name+'.pdf', 'wb')
diff --git a/test/TEX/PDFTEX.py b/test/TEX/PDFTEX.py
index 1562b20..e9b547d 100644
--- a/test/TEX/PDFTEX.py
+++ b/test/TEX/PDFTEX.py
@@ -44,7 +44,7 @@ test.write('mypdftex.py', r"""
import sys
import os
import getopt
-cmd_opts, arg = getopt.getopt(sys.argv[2:], 'i:', [])
+cmd_opts, arg = getopt.getopt(sys.argv[2:], 'i:r:', [])
base_name = os.path.splitext(arg[0])[0]
infile = open(arg[0], 'rb')
pdf_file = open(base_name+'.pdf', 'wb')
diff --git a/test/TEX/TEX.py b/test/TEX/TEX.py
index 99a69fe..58ec40d 100644
--- a/test/TEX/TEX.py
+++ b/test/TEX/TEX.py
@@ -44,7 +44,7 @@ test.write('mytex.py', r"""
import sys
import os
import getopt
-cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', [])
+cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', [])
base_name = os.path.splitext(arg[0])[0]
infile = open(arg[0], 'rb')
dvi_file = open(base_name+'.dvi', 'wb')
@@ -175,7 +175,7 @@ Run \texttt{latex}, then \texttt{bibtex}, then \texttt{latex} twice again \cite{
test.run(stderr = None)
output_lines = string.split(test.stdout(), '\n')
- reruns = filter(lambda x: string.find(x, 'latex -interaction=nonstopmode rerun.tex') != -1, output_lines)
+ reruns = filter(lambda x: string.find(x, 'latex -interaction=nonstopmode -recorder rerun.tex') != -1, output_lines)
if len(reruns) != 2:
print "Expected 2 latex calls, got %s:" % len(reruns)
print string.join(reruns, '\n')
diff --git a/test/TEX/dryrun.py b/test/TEX/dryrun.py
index adbc0b6..3764426 100644
--- a/test/TEX/dryrun.py
+++ b/test/TEX/dryrun.py
@@ -56,7 +56,7 @@ This is the foo.ltx file.
""")
test.run(arguments = '--dry-run', stdout = test.wrap_stdout("""\
-cd . && latex -interaction=nonstopmode foo.ltx ...
+cd . && latex -interaction=nonstopmode -recorder foo.ltx ...
"""), stderr = None)
diff --git a/test/TEX/eps_graphics2.py b/test/TEX/eps_graphics2.py
new file mode 100644
index 0000000..d291b0b
--- /dev/null
+++ b/test/TEX/eps_graphics2.py
@@ -0,0 +1,188 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test creation of a Tex document with nested includes in a
+subdir that needs to create a fig.pdf.
+Test creation with pdflatex
+
+Test courtesy Rob Managan.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+latex = test.where_is('latex')
+epstopdf = test.where_is('epstopdf')
+if not latex:
+ test.skip_test("Could not find 'latex'; skipping test.\n")
+
+if not epstopdf:
+ test.skip_test("Could not find 'epstopdf'; skipping test.\n")
+
+test.subdir(['docs'])
+
+
+test.write(['SConstruct'], """\
+import os
+
+env = Environment(ENV = { 'PATH' : os.environ['PATH'] })
+
+env.PDF('docs/Fig1.eps')
+test = env.PDF(source='docs/test.tex')
+""")
+
+
+test.write(['docs','Fig1.eps'], """\
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: Fig1.fig
+%%Creator: fig2dev Version 3.2 Patchlevel 4
+%%CreationDate: Tue Apr 25 09:56:11 2006
+%%For: managan@mangrove.llnl.gov (Rob Managan)
+%%BoundingBox: 0 0 98 98
+%%Magnification: 1.0000
+%%EndComments
+/$F2psDict 200 dict def
+$F2psDict begin
+$F2psDict /mtrx matrix put
+/col-1 {0 setgray} bind def
+/col0 {0.000 0.000 0.000 srgb} bind def
+
+end
+save
+newpath 0 98 moveto 0 0 lineto 98 0 lineto 98 98 lineto closepath clip newpath
+-24.9 108.2 translate
+1 -1 scale
+
+/cp {closepath} bind def
+/ef {eofill} bind def
+/gr {grestore} bind def
+/gs {gsave} bind defThe Oxygen Isotopic Composition of Captured Solar Wind: First Results from the GENESIS Mission
+/rs {restore} bind def
+/l {lineto} bind def
+/m {moveto} bind def
+/rm {rmoveto} bind def
+/n {newpath} bind def
+/s {stroke} bind def
+/slc {setlinecap} bind def
+/slj {setlinejoin} bind def
+/slw {setlinewidth} bind def
+/srgb {setrgbcolor} bind def
+/sc {scale} bind def
+/sf {setfont} bind def
+/scf {scalefont} bind def
+/tr {translate} bind def
+ /DrawEllipse {
+ /endangle exch def
+ /startangle exch def
+ /yrad exch def
+ /xrad exch def
+ /y exch def
+ /x exch def
+ /savematrix mtrx currentmatrix def
+ x y tr xrad yrad sc 0 0 1 startangle endangle arc
+ closepath
+ savematrix setmatrix
+ } def
+
+/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
+/$F2psEnd {$F2psEnteredState restore end} def
+
+$F2psBegin
+10 setmiterlimit
+ 0.06299 0.06299 sc
+%
+% Fig objects follow
+%
+7.500 slw
+% Ellipse
+n 1170 945 766 766 0 360 DrawEllipse gs col0 s gr
+
+$F2psEnd
+rs
+""")
+
+
+
+test.write(['docs','test.tex'],
+r"""\documentclass{report}
+
+\usepackage{graphicx}
+\usepackage{epsfig,color} % for .tex version of figures if we go that way
+
+\begin{document}
+
+\title{Report Title}
+
+\author{A. N. Author}
+
+\maketitle
+
+\begin{abstract}
+there is no abstract
+\end{abstract}
+
+\chapter{Introduction}
+
+The introduction is short.
+
+\section{Acknowledgements}
+
+The Acknowledgements are shown as well.
+
+To get a hard copy of this report call me.
+
+\begin{figure}[htbp]
+\begin{center}
+\includegraphics{Fig1}
+\caption{Zone and Node indexing}
+\label{fig1}
+\end{center}
+\end{figure}
+
+All done now.
+
+\end{document}
+""")
+
+# makeindex will write status messages to stderr (grrr...), so ignore it.
+test.run(arguments = '.', stderr=None)
+
+
+# All (?) the files we expect will get created in the docs directory
+files = [
+ 'docs/test.aux',
+ 'docs/test.log',
+ 'docs/test.pdf',
+]
+
+for f in files:
+ test.must_exist([ f])
+
+#test.must_not_exist(['docs/Fig1.pdf',])
+
+test.pass_test()