cgal/Packages/Manual/scripts/create_test_page

320 lines
8.7 KiB
Bash
Executable File

#! /bin/sh
#
# version: 1.0
# author: Susan Hert <hert@mpi-sb.mpg.de>
#
# This script creates a WWW page with a table of test suite results.
#
# Usage:
# create_test_page <version_name> <target_dir>
if [ $# -ne 2 ] ; then
echo "Usage: $0 <version_name> <target_dir>"
exit 1
else
VERSION="$1"
TARGET_DIR="$2"
fi
if [ -f docdirs ]; then
PART_DIRS=`cat docdirs`
else
PART_DIRS=""
fi
WWWPAGE="$VERSION.manual_test.html"
PARTS_TABLE_COLSPAN=7
PACKAGE_TABLE_COLSPAN=6
print_makeindex_test_result()
{
if [ ! -f wrapper.ilg ] ; then
echo "?"
else
if grep '[1-9][0-9]* rejected' wrapper.ilg > /dev/null ; then
echo "n"
elif grep '[1-9][0-9]* warnings' wrapper.ilg > /dev/null ; then
echo "w"
else
echo "y"
fi
fi
}
print_bibtex_test_result()
{
if [ ! -f wrapper.blg ] ; then
echo "?"
else
if grep 'error message' wrapper.blg > /dev/null ; then
echo "n"
elif grep 'warnings' wrapper.blg > /dev/null ; then
echo "w"
else
echo "y"
fi
fi
}
print_latex_test_result()
{
if [ ! -f wrapper.log ] ; then
echo "?"
else
if grep '^!' wrapper.log > /dev/null; then
echo "n"
elif grep 'LaTeX Warning' wrapper.log > /dev/null; then
echo "w"
else
echo "y"
fi
fi
}
print_html_test_result()
{
if [ ! -f html/to_html.log ] ; then
echo "?"
else
if grep 'Error' html/to_html.log > /dev/null; then
echo "n"
elif grep "Unknown" html/to_html.log > /dev/null ; then
echo "n"
elif grep "an't" html/to_html.log > /dev/null ; then
echo "n"
elif grep "ot found" html/to_html.log > /dev/null ; then
echo "n"
elif grep "ref:" html/to_html.log > /dev/null; then
echo "n"
elif grep '\\[a-m,o-z,A-Z][a-Z]+\\[a-z,A-Z]' html/to_html.log > /dev/null; then
echo "n"
else
echo "y"
fi
fi
}
print_parts_table()
{
/bin/cat << EOF
<P>
<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=5>
<TR>
<TD ALIGN=CENTER COLSPAN=$PARTS_TABLE_COLSPAN>
<FONT SIZE=+2>Reference Manual Test Results $VERSION</FONT></TD>
</TR>
<TR ALIGN=CENTER>
<TD><B>Part</B></TD>
<TD><B>makeindex</B></TD>
<TD><B>bibtex</B></TD>
<TD><B>LaTeX</B></TD>
<TD><B>ps</B></TD>
<TD><B>cc_manual_to_html</B></TD>
<TD><B>HTML</B></TD>
</TR>
<P>
EOF
for DIR in $PART_DIRS; do
if [ -d $DIR ]; then
cd $DIR
case "$DIR" in
*installation) NAME=installation;
PART_NAME="Installation";;
*general) NAME=general_intro;
PART_NAME="General Introduction";;
*kernel) NAME=kernel;
PART_NAME="2D and 3D Kernel";;
*kernel_d) NAME=kernel_d;
PART_NAME="dD Kernel";;
*basic) NAME=basic_lib;
PART_NAME="Basic Library";;
*support) NAME=support_lib;
PART_NAME="Support Library";;
*use_of_stl) NAME=use_of_stl;
PART_NAME="Use of STL";;
*) NAME=wrapper;
echo "UNKNOWN manual part; using name $DIR";
PART_NAME=$DIR;;
esac
echo "<TR>"
echo "<TD>$PART_NAME</TD>"
RESULT=`print_makeindex_test_result`
if [ $RESULT = "y" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.ilg class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.ilg class=warning>$RESULT</A></TD>"
elif [ $RESULT = "n" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.ilg class=error>$RESULT</A></TD>"
else
echo "<TD ALIGN=CENTER>$RESULT</TD>"
fi
RESULT=`print_bibtex_test_result`
if [ $RESULT = "y" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.blg class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.blg class=warning>$RESULT</A></TD>"
elif [ $RESULT = "n" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.blg class=error>$RESULT</A></TD>"
else
echo "<TD ALIGN=CENTER>$RESULT</TD>"
fi
RESULT=`print_latex_test_result`
if [ $RESULT = "y" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.log class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.log class=warning>$RESULT</A></TD>"
else
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/wrapper.log class=error>$RESULT</A></TD>"
fi
echo "<TD><A HREF=$TARGET_DIR/$DIR/$NAME.ps.gz>ps</A></TD>"
RESULT=`print_html_test_result`
if [ $RESULT = "y" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/to_html.log class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/to_html.log class=warning>$RESULT</A></TD>"
else
echo "<TD ALIGN=CENTER> \
<A HREF=$TARGET_DIR/$DIR/to_html.log class=error>$RESULT</A></TD>"
fi
echo "<TD><A HREF=$TARGET_DIR/html/$NAME/contents.html>HTML</A></TD>"
echo "</TR>"
cd ..
fi
done
echo "</TABLE>"
echo "</P>"
}
print_packages_table()
{
/bin/cat << EOF
<P>
<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=5>
<TR>
<TD ALIGN=CENTER COLSPAN=$PACKAGE_TABLE_COLSPAN>
<FONT SIZE=+2>Individual Package/Directory Test Results $VERSION</FONT></TD>
</TR>
<TR ALIGN=CENTER>
<TD><B>Part</B></TD>
<TD><B>Package or Directory</B></TD>
<TD><B>makeindex</B></TD>
<TD><B>LaTeX</B></TD>
<TD><B>cc_manual_to_html</B></TD>
EOF
for DIR in $PART_DIRS; do
case $DIR in
*installation) PART_NAME="Installation";;
*general) PART_NAME="General Introduction";;
*kernel) PART_NAME="2D and 3D Kernel";;
*kernel_d) PART_NAME="dD Kernel";;
*basic) PART_NAME="Basic Library";;
*support) PART_NAME="Support Library";;
*use_of_stl) PART_NAME="Use of STL";;
*) echo "UNKNOWN manual part; using name $DIR";
PART_NAME=$DIR;;
esac
if [ -f $DIR/docdirs ]; then
create_package_table $DIR
fi
done
echo "</TABLE>"
echo "</P>"
}
print_resultpage()
{
/bin/cat << EOF
<HTML>
<HEAD><TITLE>CGAL Reference Manual Test Results</TITLE>
<LINK REL=stylesheet HREF="testresult.css">
</HEAD>
<BODY>
<H1>CGAL Reference Manual Test Results</H1>
This page shows the results of running scripts to create
the reference manual for $VERSION. The conversion of each package's
contribution to the manual was tested separately, first for problems with
LaTeX and <TT>makeindex</TT> and then for problems during the HTML conversion
using <TT>cc_manual_to_html</TT>.
In the table below a 'y' means no blatant errors occurred,
which may be loosely interpreted as 'success', a 'w' means there was a warning,
and a 'n' means 'failure'. LaTeX log files for individual packages and
directories have not been scanned for warnings
since it is very unlikely that with this partitioned test any package would
make it through without a warning. The log files for the makeindex, bibtex,
LaTeX, and HTML conversions can to retrieved by clicking on the associated
result indicators.
<P>
Please note:
<UL>
<LI> Due to the separate testing of each package, some references in the
LaTeX manual may remain unresolved by the individual directory/package
tests. <B>Please check the log files for the appropriate part of the
manual to see if all references were finally resolved.</B>
<LI> Only when all packages have a 'y" in the LaTeX column will the table of
contents for the full manual be correct.
<LI> <B>The detection of errors is not exact. You should look at the log
files even when a "y" appears suggesting that everything is OK.</B>
<LI> A (rather rudimentary)
<A HREF="test_manual/html/gif_grep_list.html">test for broken picture
links</A> is also performed. Follow the link to your chapter(s) to
see if there are pictures that couldn't be found.
</UL>
</P>
<HR>
EOF
print_parts_table
print_packages_table
/bin/cat << EOF
<HR>
<I><FONT SIZE=-1>Author:
Susan Hert <A HREF="mailto:hert@mpi-sb.mpg.de">hert@mpi-sb.mpg.de</A></FONT></I>
</BODY>
</HTML>
EOF
}
/bin/rm -f $WWWPAGE
print_resultpage > $WWWPAGE