mirror of https://github.com/CGAL/cgal
346 lines
14 KiB
Bash
Executable File
346 lines
14 KiB
Bash
Executable File
#!/bin/sh
|
|
# collect_cgal_testresults_from_cmake
|
|
# ===================================
|
|
# 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_TESTER, CGAL_TESTER_NAME, CGAL_TESTER_ADDRESS are environment variables.
|
|
|
|
|
|
if [ -z "${CGAL_TEST_PLATFORM}" ]; then
|
|
|
|
CGAL_TEST_PLATFORM=`dirname $PWD`
|
|
echo "CGAL_TEST_PLATFORM not in the environment, setting it to ${CGAL_TEST_PLATFORM}"
|
|
fi
|
|
|
|
if [ -z "$1" ] ; then
|
|
TEST_DIRECTORIES=`ls`
|
|
else
|
|
TEST_DIRECTORIES="$*"
|
|
fi
|
|
|
|
GENERAL_BUILD_LOGFILE=''
|
|
PLATFORM_BUILD_LOGFILE=''
|
|
TEST_REPORT=''
|
|
RESULT_FILE=''
|
|
shared_or_static=''
|
|
|
|
#print_testresult <platform> <directory>
|
|
# print result on stdout
|
|
# print timings on fd3
|
|
print_testresult()
|
|
{
|
|
if [ ! -f ErrorOutput_$1 ] ; then
|
|
RESULT="?"
|
|
TIMING="?"
|
|
else
|
|
if eval 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.
|
|
# 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 ',' or ':'. That avoids some false positives such as
|
|
# '-read_only_relocs,warning' or '-D_CRT_SECURE_NO_WARNINGS', or
|
|
# 'QMessageBox::warning'.
|
|
if grep -v -F 'CMake Warning at /usr/share/cmake/Modules/FindBoost' CompilerOutput_$1 ProgramOutput.*.$1 | grep -i -E -q '(^|[^a-zA-Z_,:-])warning'
|
|
then
|
|
RESULT="w"
|
|
else
|
|
if grep -E -q 'NOTICE: .*(need|require|incompatible).*and.*will not be' CompilerOutput_$1
|
|
then
|
|
RESULT="r"
|
|
else
|
|
RESULT="y"
|
|
fi
|
|
fi
|
|
fi
|
|
TIMING=`awk '/^ # Running time: / {print $4}' < ErrorOutput_$1`
|
|
fi
|
|
echo "$2 $TIMING" >&3
|
|
echo "$2 $RESULT"
|
|
}
|
|
|
|
|
|
parse_shared_or_static()
|
|
{
|
|
if [ -f "${PLATFORM_BUILD_LOGFILE}" ] ; then
|
|
|
|
if grep "Building shared libraries" ${PLATFORM_BUILD_LOGFILE} >/dev/null 2>&1; then
|
|
shared_or_static='shared'
|
|
else
|
|
shared_or_static='static'
|
|
fi
|
|
|
|
else
|
|
shared_or_static='shared'
|
|
fi
|
|
}
|
|
|
|
parse_flags_and_third_party_choices()
|
|
{
|
|
grep -e "^-- USING " ${PLATFORM_BUILD_LOGFILE} >> $RESULT_FILE
|
|
echo "------------" >> $RESULT_FILE
|
|
}
|
|
|
|
parse_lib_building_results()
|
|
{
|
|
libname=$1
|
|
target=$2
|
|
|
|
if [ ! -e "${libname}_${shared_or_static}" ]; then
|
|
mkdir "${libname}_${shared_or_static}"
|
|
fi
|
|
|
|
y_or_no='n'
|
|
|
|
configured=''
|
|
|
|
if [ -f "${PLATFORM_BUILD_LOGFILE}" ]; then
|
|
|
|
if grep -q "Built target ${target}" ${PLATFORM_BUILD_LOGFILE} ; then
|
|
y_or_no='y'
|
|
fi
|
|
|
|
marker_beg=`grep -e "${target}.dir/depend$" ${PLATFORM_BUILD_LOGFILE} | head -1`
|
|
|
|
if [ -n "${marker_beg}" ]; then
|
|
|
|
configured='y'
|
|
|
|
if [ ! "$target" = "CGAL" ]; then
|
|
cat ${PLATFORM_BUILD_LOGFILE} | sed -n "\|${marker_beg}|,\|depend$| p" >> ${libname}_${shared_or_static}/$TEST_REPORT
|
|
fi
|
|
|
|
# Test if there is a warning in the build log.
|
|
if [ "$y_or_no" = "y" ]; then
|
|
# See the comment line 38.
|
|
if grep -i -E -q '(^|[^a-zA-Z_,:-])warning' ${libname}_${shared_or_static}/$TEST_REPORT ; then
|
|
y_or_no='w'
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ -z "${configured}" ] ; then
|
|
y_or_no='r'
|
|
echo "Not configured!" >> ${libname}_${shared_or_static}/$TEST_REPORT
|
|
fi
|
|
|
|
echo ${libname}_${shared_or_static} $y_or_no >> $RESULT_FILE
|
|
}
|
|
|
|
output_main_logs()
|
|
{
|
|
[ -e Installation ] || mkdir "Installation"
|
|
|
|
INSTALLATION_TEST_REPORT="Installation/$TEST_REPORT"
|
|
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " General Build Log " >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "${GENERAL_BUILD_LOGFILE}" ] ; then
|
|
cat "${GENERAL_BUILD_LOGFILE}" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " Platform-specific Build Log " >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "${PLATFORM_BUILD_LOGFILE}" ] ; then
|
|
cat "${PLATFORM_BUILD_LOGFILE}" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
if [ -f "$HOME/.autocgal_with_cmake_rc" ] ; then
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " .autocgal_with_cmake_rc" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
cat "$HOME/.autocgal_with_cmake_rc" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
if [ -f "$HOME/.autocgalrc" ] ; then
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " .autocgalrc" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
cat "$HOME/.autocgalrc" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
fi
|
|
|
|
if [ -f "../setup" ] ; then
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " setup" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
cat "../setup" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " CMakeCache.txt" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "../CMakeCache.txt" ] ; then
|
|
cat "../CMakeCache.txt" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " include/CGAL/compiler_config.h" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "../include/CGAL/compiler_config.h" ] ; then
|
|
cat "../include/CGAL/compiler_config.h" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " CGALConfig.cmake" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "../CGALConfig.cmake" ] ; then
|
|
cat "../CGALConfig.cmake" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " CMakeError.log" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "../CMakeFiles/CMakeError.log" ] ; then
|
|
cat "../CMakeFiles/CMakeError.log" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo " CMakeOutput.log" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "---------------------------------------------------------------" >> "$INSTALLATION_TEST_REPORT"
|
|
echo "" >> "$INSTALLATION_TEST_REPORT"
|
|
if [ -f "../CMakeFiles/CMakeOutput.log" ] ; then
|
|
cat "../CMakeFiles/CMakeOutput.log" >> "$INSTALLATION_TEST_REPORT"
|
|
else
|
|
echo "Not found!" >> "$INSTALLATION_TEST_REPORT"
|
|
fi
|
|
|
|
}
|
|
|
|
echo "---------------------------------------------------------------"
|
|
echo " Collecting results of platform $CGAL_TEST_PLATFORM"
|
|
echo "---------------------------------------------------------------"
|
|
|
|
CURRENT_DIR=`pwd`
|
|
TESTER=${CGAL_TESTER:-${USER:-`whoami`}}
|
|
TESTER_NAME="${CGAL_TESTER_NAME:-${TESTER}}"
|
|
TESTER_ADDRESS="${CGAL_TESTER_ADDRESS:-${TESTER}}"
|
|
TEST_REPORT="TestReport_${TESTER}_${CGAL_TEST_PLATFORM}"
|
|
RESULT_FILE="$CURRENT_DIR/results_${TESTER}_${CGAL_TEST_PLATFORM}.txt"
|
|
TIMING_FILE="$CURRENT_DIR/timings_${TESTER}_${CGAL_TEST_PLATFORM}.txt"
|
|
CGAL_DIR=../../../..
|
|
GENERAL_BUILD_LOGFILE="../../installation.log"
|
|
PLATFORM_BUILD_LOGFILE="../installation.log"
|
|
rm -f "$RESULT_FILE" "$TIMING_FILE"
|
|
touch "$RESULT_FILE" "$TIMING_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 "CGAL_TEST_PLATFORM ${CGAL_TEST_PLATFORM}" >> "$RESULT_FILE"
|
|
echo "General installation log file: ${GENERAL_BUILD_LOGFILE}" >> "$RESULT_FILE"
|
|
echo "Host-specific installation log file: ${PLATFORM_BUILD_LOGFILE}" >> "$RESULT_FILE"
|
|
|
|
parse_shared_or_static
|
|
|
|
output_main_logs
|
|
|
|
parse_flags_and_third_party_choices
|
|
|
|
parse_lib_building_results "libCGAL" "CGAL"
|
|
parse_lib_building_results "libCGALCore" "CGAL_Core"
|
|
parse_lib_building_results "libCGALimageIO" "CGAL_ImageIO"
|
|
parse_lib_building_results "libCGALQt5" "CGAL_Qt5"
|
|
|
|
for DIR in $TEST_DIRECTORIES ; do
|
|
if [ -d "$DIR" ] ; then
|
|
echo " $DIR ..."
|
|
cd "$DIR"
|
|
|
|
print_testresult "$CGAL_TEST_PLATFORM" "$DIR" >> "$RESULT_FILE" 3>>"$TIMING_FILE"
|
|
|
|
if [ ! "$DIR" = "Installation" ] ; then
|
|
rm -f "${TEST_REPORT}"
|
|
touch "$TEST_REPORT"
|
|
fi
|
|
if [ -f .scm-urls ]; then
|
|
echo " Test files from:" >> "$TEST_REPORT"
|
|
cat .scm-urls >> "$TEST_REPORT"
|
|
echo >> "$TEST_REPORT"
|
|
elif [ -f ../../../../../.scm-branch ]; then
|
|
cat ../../../../../.scm-branch >> "$TEST_REPORT"
|
|
echo >> "$TEST_REPORT"
|
|
fi
|
|
|
|
if [ ! -f ErrorOutput_${CGAL_TEST_PLATFORM} ] ; then
|
|
echo "Error: file $DIR/ErrorOutput_${CGAL_TEST_PLATFORM} does not exist!"
|
|
else
|
|
cat ErrorOutput_${CGAL_TEST_PLATFORM} >> "$TEST_REPORT"
|
|
fi
|
|
|
|
if [ ! -f CompilerOutput_${CGAL_TEST_PLATFORM} ] ; then
|
|
echo "Error: file $DIR/CompilerOutput_${CGAL_TEST_PLATFORM} does not exist!"
|
|
else
|
|
cat CompilerOutput_${CGAL_TEST_PLATFORM} >> "$TEST_REPORT"
|
|
fi
|
|
|
|
if 2>&1 eval ls ProgramOutput.*.${CGAL_TEST_PLATFORM} > /dev/null ; then
|
|
PROGRAM_OUTPUT=`ls ProgramOutput.*"$CGAL_TEST_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}_${CGAL_TEST_PLATFORM}.tar
|
|
rm -f $OUTPUT_FILE $OUTPUT_FILE.gz
|
|
tar cf $OUTPUT_FILE results_${TESTER}_${CGAL_TEST_PLATFORM}.txt timings_${TESTER}_${CGAL_TEST_PLATFORM}.txt */"$TEST_REPORT"
|
|
echo
|
|
echo "compressing ..."
|
|
gzip -9f $OUTPUT_FILE
|
|
echo "results written to file $OUTPUT_FILE.gz"
|
|
echo
|
|
|
|
|
|
# Local Variables:
|
|
# standard-indent: 2
|
|
# End:
|