mirror of https://github.com/CGAL/cgal
190 lines
6.1 KiB
Bash
Executable File
190 lines
6.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# collect_cgal_testresults
|
|
# ========================
|
|
# collect all files to generate the html page
|
|
# containing the testsuite results
|
|
#
|
|
# to be run in the CGAL/test directory or a local test directory.
|
|
# $CGAL_MAKEFILE is used to find out $CGAL_DIR.
|
|
# CGAL_TESTER, CGAL_TESTER_NAME, CGAL_TESTER_ADDRESS are also used as
|
|
# environment variables.
|
|
|
|
# attempt to find a POSIX grep, even on Solaris.
|
|
OLD_PATH=$PATH
|
|
GREP=grep
|
|
GETCONF=`which getconf`
|
|
OLD_GREP=`which grep`
|
|
if [ -n "$GETCONF" ]; then
|
|
GETCONF_PATH=`getconf PATH`
|
|
if [ -n "$GETCONF_PATH" ]; then
|
|
PATH=$GETCONF_PATH
|
|
NEW_GREP=`which grep`
|
|
if [ -n "$NEW_GREP" -a "x$NEW_GREP" != "x$OLD_GREP" ]; then
|
|
printf 'Use %s as POSIX grep.\n' "$NEW_GREP"
|
|
GREP=$NEW_GREP
|
|
fi
|
|
fi
|
|
fi
|
|
PATH=$OLD_PATH
|
|
|
|
print_platforms()
|
|
{
|
|
cd Number_types # Pick a stable directory at random
|
|
for FILE in `ls CompilerOutput_*` ; do
|
|
PLATFORM=`echo $FILE | sed 's/CompilerOutput_//'| sed 's/\.gz//'`
|
|
printf "$PLATFORM "
|
|
done
|
|
cd ..
|
|
}
|
|
|
|
#print_testresult <platform> <directory>
|
|
print_testresult()
|
|
{
|
|
if [ ! -f "ErrorOutput_$1" ] ; then
|
|
RESULT="?"
|
|
else
|
|
if $GREP ERROR "ErrorOutput_$1" > /dev/null ; then
|
|
RESULT="n"
|
|
else
|
|
# grep -q means "quiet": no output, the return code is 0 iff the file
|
|
# matches the regular expression.
|
|
# (LR, 2008/08/22: it seems grep on Solaris still does not understand "-q"!)
|
|
# grep -i means "case insensitive".
|
|
# grep -E means "extended regular expressions".
|
|
# All those three options are in the Single Unix Specification version 3
|
|
# The extended regular expression '[^a-zA-Z_,]warning' matches any
|
|
# string "warning" preceded with a letter that is not a letter or '_' or ','
|
|
# That avoids some false positives such as
|
|
# '-read_only_relocs,warning' or '-D_CRT_SECURE_NO_WARNINGS'
|
|
if $GREP -i -E '(^|[^a-zA-Z_,])warning' "CompilerOutput_$1" ProgramOutput.*.$1 > /dev/null ; then
|
|
RESULT="w"
|
|
else
|
|
RESULT="y"
|
|
fi
|
|
fi
|
|
fi
|
|
echo "$2 $RESULT"
|
|
}
|
|
|
|
# do_platform <platform>
|
|
do_platform()
|
|
{
|
|
PLATFORM=$1
|
|
CURRENT_DIR=`pwd`
|
|
TESTER=${CGAL_TESTER:-${USER:-`whoami`}}
|
|
TESTER_NAME="${CGAL_TESTER_NAME:-${TESTER}}"
|
|
TESTER_ADDRESS="${CGAL_TESTER_ADDRESS:-${TESTER}}"
|
|
TEST_REPORT="TestReport_${TESTER}_${PLATFORM}"
|
|
RESULT_FILE=$CURRENT_DIR/results_${TESTER}_${PLATFORM}.txt
|
|
CGAL_DIR=..
|
|
if [ "${CGAL_MAKEFILE}" ]; then
|
|
CGAL_DIR=`dirname $CGAL_MAKEFILE`/..
|
|
fi
|
|
rm -f "$RESULT_FILE"
|
|
touch "$RESULT_FILE"
|
|
sed -n '/CGAL_VERSION /s/#define //p' < "$CGAL_DIR/include/CGAL/version.h" >> "$RESULT_FILE"
|
|
echo "TESTER ${TESTER}" >> "$RESULT_FILE"
|
|
echo "TESTER_NAME ${TESTER_NAME}" >> "$RESULT_FILE"
|
|
echo "TESTER_ADDRESS ${TESTER_ADDRESS}" >> "$RESULT_FILE"
|
|
echo "GREP ${GREP}" >> "$RESULT_FILE"
|
|
echo "PLATFORM ${PLATFORM}" >> "$RESULT_FILE"
|
|
|
|
LEDA_INCL_DIR=`cat "${CGAL_DIR}/config/install/${PLATFORM}" |sed -n '/LEDA_INCL_DIR/s/^.*= .\([^ ]*\). .*$/\1/p'`
|
|
if [ -r "${LEDA_INCL_DIR}/LEDA/basic.h" ]; then
|
|
sed -n '/__LEDA__/s/^#define __LEDA__/LEDA version/p' < "${LEDA_INCL_DIR}/LEDA/basic.h" >>"$RESULT_FILE"
|
|
fi
|
|
|
|
cat "${CGAL_DIR}/config/install/${PLATFORM}" >> "$RESULT_FILE"
|
|
echo "------------" >> "$RESULT_FILE"
|
|
|
|
if [ -f "install.log.${PLATFORM}" ] ; then
|
|
[ -f install.log ] && cat install.log >> "Installation/ProgramOutput.install.log.${PLATFORM}"
|
|
cat "install.log.${PLATFORM}" >> "Installation/ProgramOutput.install.log.${PLATFORM}"
|
|
|
|
grep "Compilation of" "install.log.${PLATFORM}" \
|
|
| awk '{ print $3 " " $4 " " $6; }' \
|
|
| sed -e 's/succeeded\.$/y/' -e 's/failed\.$/n/' \
|
|
| while read libname shared_or_static y_or_no; do
|
|
mkdir "${libname}_${shared_or_static}"
|
|
|
|
# Make sure to let the following variable _buildlog_marker be synced
|
|
# with the variable _buildlog_marker from the script install_cgal.
|
|
_buildlog_marker="log for ${libname} ${shared_or_static} shown"
|
|
|
|
cat "install.log.${PLATFORM}" \
|
|
| sed -n "/${_buildlog_marker} below/,/${_buildlog_marker} above/ p" \
|
|
> "${libname}_${shared_or_static}/$TEST_REPORT"
|
|
|
|
# Test if there is a warning in the build log.
|
|
if [ "$y_or_no" = "y" ]; then
|
|
# See the comment line 31.
|
|
if $GREP -i -E '[^a-zA-Z_,]warning' "${libname}_${shared_or_static}/$TEST_REPORT" > /dev/null ; then
|
|
y_or_no=w
|
|
fi
|
|
fi
|
|
|
|
echo ${libname}_${shared_or_static} $y_or_no >> "$RESULT_FILE"
|
|
done
|
|
fi
|
|
|
|
for DIR in $TEST_DIRECTORIES ; do
|
|
if [ -d $DIR ] ; then
|
|
echo " $DIR ..."
|
|
cd $DIR
|
|
|
|
print_testresult $PLATFORM $DIR >> "$RESULT_FILE"
|
|
|
|
rm -f "${TEST_REPORT}"
|
|
touch "$TEST_REPORT"
|
|
|
|
if [ ! -f "ErrorOutput_${PLATFORM}" ] ; then
|
|
echo "Error: file $DIR/ErrorOutput_${PLATFORM} does not exist!"
|
|
else
|
|
cat "ErrorOutput_${PLATFORM}" >> "$TEST_REPORT"
|
|
fi
|
|
|
|
if [ ! -f CompilerOutput_${PLATFORM} ] ; then
|
|
echo "Error: file $DIR/CompilerOutput_${PLATFORM} does not exist!"
|
|
else
|
|
cat CompilerOutput_${PLATFORM} >> "$TEST_REPORT"
|
|
fi
|
|
|
|
if 2>&1 eval ls ProgramOutput.*.${PLATFORM} > /dev/null ; then
|
|
PROGRAM_OUTPUT=`ls ProgramOutput.*$PLATFORM*`
|
|
for FILE in $PROGRAM_OUTPUT ; do
|
|
echo >> "$TEST_REPORT"
|
|
echo "------------------------------------------------------------------" >> "$TEST_REPORT"
|
|
echo "- $FILE" >> "$TEST_REPORT"
|
|
echo "------------------------------------------------------------------" >> "$TEST_REPORT"
|
|
cat "$FILE" >> "$TEST_REPORT"
|
|
done
|
|
fi
|
|
|
|
cd ..
|
|
fi
|
|
done
|
|
|
|
OUTPUT_FILE=results_${TESTER}_${PLATFORM}.tar
|
|
rm -f "$OUTPUT_FILE" "$OUTPUT_FILE.gz"
|
|
tar cf "$OUTPUT_FILE" results_${TESTER}_${PLATFORM}.txt */"$TEST_REPORT"
|
|
echo
|
|
echo "compressing ..."
|
|
gzip -9f "$OUTPUT_FILE"
|
|
echo "results written to file $OUTPUT_FILE.gz"
|
|
echo
|
|
}
|
|
|
|
if [ -z "$1" ] ; then
|
|
TEST_DIRECTORIES=`ls`
|
|
else
|
|
TEST_DIRECTORIES="$*"
|
|
fi
|
|
|
|
for PLATFORM in `print_platforms` ; do
|
|
echo "---------------------------------------------------------------"
|
|
echo " Collecting results of platform $PLATFORM"
|
|
echo "---------------------------------------------------------------"
|
|
do_platform $PLATFORM
|
|
done
|
|
|