cgal/Packages/Manual/scripts/create_package_table

187 lines
5.0 KiB
Bash
Executable File

#! /bin/sh
#
# version: 1.0
# author: Susan Hert <hert@mpi-sb.mpg.de>
#
# This script creates part of a WWW page with a table of test suite results.
# The formatted table is printed to standard output.
#
# Usage:
# create_package_table [d1 d2 ...]
#
TARGETS="dvi html"
# if directory names are provided on the command line, use these as the
# directories for which test results are prepared. Otherwise, when in a
# directory that contains a wrapper.tex file and a docdirs file assume
# this is the directory to work in. If the current directory contains
# no wrapper.tex file but a docdirs file, this indicates that a page
# should be created for the test results of all subdirectories named in
# docdirs.
if [ $# -ne 0 ] ; then
DOCDIRS="$*"
elif [ -f wrapper.tex -a -f docdirs ]; then
DOCDIRS="."
elif [ -f docdirs ] ; then
DOCDIRS=`/bin/cat docdirs`
else
DOCDIRS=""
fi
#NT = number of targets
NT=0
for i in $TARGETS ; do
NT=`expr $NT + 1`
done
print_makeindex_test_result()
{
if [ ! -f main.ilg ] ; then
echo "?"
else
if grep '[1-9][0-9]* rejected' main.ilg > /dev/null ; then
echo "n"
elif grep '[1-9][0-9]* warnings' main.ilg > /dev/null ; then
echo "w"
else
echo "y"
fi
fi
}
print_latex_test_result()
{
if [ ! -f main.log ] ; then
echo "?"
else
for FAILURE in $LATEX_FAILED; do
if [ $FAILURE = $TEST_DIR ]; then
echo "n"
return
fi
done
echo "y"
fi
}
print_html_test_result()
{
if [ ! -f to_html.log ] ; then
echo "?"
else
for FAILURE in $HTML_FAILED; do
if [ $FAILURE = $TEST_DIR ]; then
echo "n"
return
fi
done
echo "y"
fi
}
print_result_table()
{
for TEST_DIR in $TEST_DIRECTORIES ; do
if [ -d $TEST_DIR ] ; then
cd $TEST_DIR
echo
echo "<TR>"
if [ $TEST_DIR = "Title" ]; then
echo "<TD>$PART_NAME</TD>"
else
echo "<TD></TD>"
fi
echo "<TD>$TEST_DIR</TD>"
# if [ -f version ] ; then
# echo "<TD ALIGN=CENTER>`/bin/awk '{ print $1 }' version`</TD>"
# elif [ $TEST_DIR != "Title" ]; then
# echo "<TD ALIGN=CENTER>?.?</TD>"
# else
# echo "<TD ALIGN=CENTER>-</TD>"
# fi
RESULT=`print_makeindex_test_result`
if [ $RESULT = "y" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/main.ilg class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/main.ilg class=warning>$RESULT</A></TD>"
elif [ $RESULT = "n" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/main.ilg 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=test_manual/$DIR/$TEST_DIR/main.log class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/main.log class=warning>$RESULT</A></TD>"
else
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/main.log class=error>$RESULT</A></TD>"
fi
cd ..
if [ -d html_test/$TEST_DIR ]; then
cd html_test/$TEST_DIR/
RESULT=`print_html_test_result`
if [ $RESULT = "y" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/to_html.log class=ok>$RESULT</A></TD>"
elif [ $RESULT = "w" ]; then
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/to_html.log class=warning>$RESULT</A></TD>"
else
echo "<TD ALIGN=CENTER> \
<A HREF=test_manual/$DIR/$TEST_DIR/to_html.log class=error>$RESULT</A></TD>"
fi
cd ../..
else
echo "<TD ALIGN=CENTER>not applicable</TD>"
fi
echo "</TR>"
fi
done
/bin/cat << EOF
EOF
}
for DIR in $DOCDIRS; do
if [ -f $DIR/docdirs ]; then
cd $DIR
TEST_DIRECTORIES=`cat docdirs`
if [ -f docdirs_failed_tex ]; then
LATEX_FAILED=`/bin/cat docdirs_failed_tex`
else
LATEX_FAILED=""
fi
if [ -f docdirs_failed_html ]; then
HTML_FAILED=`/bin/cat docdirs_failed_html`
else
HTML_FAILED=""
fi
CURR_DIR=`pwd`
case $CURR_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
print_result_table
cd ..
fi
done