#!/bin/sh
necho() {
if [ "`echo -n`" = "-n" ]; then
echo "${@}\c"
else
echo -n "${@}"
fi
}
echo "Testing the SWIG C/C++ parser..."
# Make some of the larger files
perl makelarge.pl >large_comment.i
perl makeheader.pl >large_header.i
IFILE='
addmethods array code conditional constant cpp_const cpp_data cpp_func
cpp_inherit cpp_misc defarg doc enum_cond except extern function graph inline
library macro modlist multiline multinherit native nested new objc opengl ref
reference rename struct template test0.1a typedef typemap unsigned value
variable vector_ex void zero
large_comment
large_header'
LOGFILE='../../test.log'
rm -f ${LOGFILE}
echo "\nPerforming parser/regression tests on Perl5 module..."
for i in ${IFILE}; do
necho " Testing (Perl5) : ${i}.i";
if ../../swig -I../../swig_lib -perl5 -dnone -c++ -objc ${i}.i >${i}.perl5.output 2>&1; then
# Look for a regression testing file
if test -f ${i}_regr.perl5.c; then
if diff ${i}_regr.perl5.c ${i}_wrap.c > ${i}.perl5.diff; then
echo " ....... passed"
rm -f ${i}.perl5.diff
else
echo " ....... FAILED COMPARE (see ${i}.perl5.diff) ***";
echo "${i}.i (Perl5) ....... FAILED COMPARE (see ${i}.perl5.diff) ***" >> ${LOGFILE}
fi;
else
# Regression testing file doesn't exist, create it
echo " ....... passed (creating ${i}_regr.perl5.c)"
mv ${i}_wrap.c ${i}_regr.perl5.c
fi;
rm -f ${i}_wrap*
else
echo " ....... FAILED (INTERNAL ERROR) ***";
echo "${i}.i (Perl5) ....... FAILED (INTERNAL ERROR) ***" >> ${LOGFILE}
fi;
done
echo "\nPerforming parser/regression tests on Perl5 shadow classes..."
for i in ${IFILE}; do
necho " Testing (Perl5 shadow) : ${i}.i";
if ../../swig -I../../swig_lib -perl5 -shadow -dnone -c++ -objc ${i}.i >${i}.perl5s.output 2>&1; then
# Look for a regression testing file
if test -f ${i}_regr.perl5s.c; then
if diff ${i}_regr.perl5s.c ${i}_wrap.c > ${i}.perl5s.diff; then
echo " ....... passed"
rm -f ${i}.perl5s.diff
else
echo " ....... FAILED COMPARE (see ${i}.perl5s.diff) ***";
echo "${i}.i (Perl5 shadow) ....... FAILED COMPARE (see ${i}.perl5s.diff) ***" >> ${LOGFILE}
fi;
else
# Regression testing file doesn't exist, create it
echo " ....... passed (creating ${i}_regr.perl5s.c)"
mv ${i}_wrap.c ${i}_regr.perl5s.c
fi;
rm -f ${i}_wrap*
else
echo " ....... FAILED (INTERNAL ERROR) ***";
echo "${i}.i (Perl5 shadow) ....... FAILED (INTERNAL ERROR) ***" >> ${LOGFILE}
fi;
done
if test -s ${LOGFILE}; then
echo "***** ERRORS were detected. See ${LOGFILE} for a summary."
fi
syntax highlighted by Code2HTML, v. 0.9.1