improve cleanup and simplify makefile management a little

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32245 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-02-20 14:59:52 +00:00
parent c6ab8dbb82
commit a4c7b55edc
2 changed files with 57 additions and 68 deletions

View file

@ -180,8 +180,12 @@ present()
run_test_file ()
{
if test "$GSTESTMODE" != "clean"
if test "$GSTESTMODE" = "clean"
then
# Clean the test. Log everything to a temporary file.
$RUNCMD $run_args $TESTFILE > /dev/null 2>&1
return
else
echo >> $GSTESTLOG
echo Testing $TESTFILE... >> $GSTESTLOG
echo >> $GSTESTSUM
@ -245,10 +249,6 @@ do
if test "$GSTESTMODE" = "clean"
then
echo "--- Cleaning tests in $dir ---"
rm -rf core obj GNUmakefile.tmp
rm -f tests.tmp tests.sum.tmp tests.log.tmp
rm -f tests.log tests.sum
rm -f oldtests.log oldtests.sum
else
echo "--- Running tests in $dir ---"
if test -r ./Start.sh -a -x ./Start.sh
@ -273,18 +273,24 @@ do
fi
# Now we process each test file in turn.
# When cleaning, we only need to do one clean per directory.
for TESTFILE in $TESTS
do
run_test_file
if test "$RUNEXIT" != "0"
if test "$RUNEXIT" != "0" -o "$GSTESTMODE" = "clean"
then
break
fi
done
TESTS=
if test "$GSTESTMODE" != "clean"
if test "$GSTESTMODE" = "clean"
then
rm -rf core obj GNUmakefile
rm -f tests.tmp tests.sum.tmp tests.log.tmp
rm -f tests.log tests.sum
rm -f oldtests.log oldtests.sum
else
# And perform the cleanup script.
if test -r ./End.sh -a -x ./End.sh
then

View file

@ -155,84 +155,67 @@ then
# Create the GNUmakefile by filling in the name of the test,
# the name of the file, the include directory, and the failfast
# option if needed.
rm -f GNUmakefile
if test "$GSTESTMODE" = "failfast"
then
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@/-DFAILFAST=1/;s^@INCLUDEDIR@^$TOP^" < $TEMPLATE > GNUmakefile.tmp
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@/-DFAILFAST=1/;s^@INCLUDEDIR@^$TOP^" < $TEMPLATE > GNUmakefile
else
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@//;s^@INCLUDEDIR@^$TOP^" < $TEMPLATE > GNUmakefile.tmp
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@//;s^@INCLUDEDIR@^$TOP^" < $TEMPLATE > GNUmakefile
fi
rm -f GNUmakefile.bck
if test -e GNUmakefile
then
mv GNUmakefile GNUmakefile.bck
fi
mv GNUmakefile.tmp GNUmakefile
# Clean up to avoid contamination by previous tests. (Optimistically) assume
# that this will never fail in any interesting way.
$MAKE_CMD clean >/dev/null 2>&1
# Compile it. Redirect errors to stdout so it shows up in the log, but not
# in the summary.
$MAKE_CMD $MAKEFLAGS debug=yes 2>&1
if test $? != 0
if test "$GSTESTMODE" = "clean"
then
echo "Failed build: $1" >&2
if test "$GSTESTMODE" = "failfast"
then
mv GNUmakefile GNUmakefile.tmp
if test -e GNUmakefile.bck
then
mv GNUmakefile.bck GNUmakefile
fi
exit 99
fi
rm -f GNUmakefile
rm -rf obj core
else
# We want aggressive memory checking.
# Tell glibc to check for malloc errors, and to crash if it detects
# any.
MALLOC_CHECK_=2
export MALLOC_CHECK
# Tell GNUstep-base to check for messages sent to deallocated objects
# and crash if it happens.
NSZombieEnabled=YES
CRASH_ON_ZOMBIE=YES
export NSZombieEnabled CRASH_ON_ZOMBIE
echo Running $1...
# Run it. If it terminates abnormally, mark it as a crash (unless we have
# a special file to mark it as being expected to abort).
$MAKE_CMD -s test
# Compile it. Redirect errors to stdout so it shows up in the log,
# but not in the summary.
$MAKE_CMD $MAKEFLAGS debug=yes 2>&1
if test $? != 0
then
if test -r $NAME.abort
echo "Failed build: $1" >&2
if test "$GSTESTMODE" = "failfast"
then
echo "Completed file: $1" >&2
else
echo "Failed file: $1 aborted without running all tests!" >&2
if test "$GSTESTMODE" = "failfast"
then
mv GNUmakefile GNUmakefile.tmp
if test -e GNUmakefile.bck
then
mv GNUmakefile.bck GNUmakefile
fi
exit 99
fi
exit 99
fi
else
echo "Completed file: $1" >&2
fi
fi
# We want aggressive memory checking.
# Restore any old makefile
mv GNUmakefile GNUmakefile.tmp
if test -e GNUmakefile.bck
then
mv GNUmakefile.bck GNUmakefile
# Tell glibc to check for malloc errors, and to crash if it detects
# any.
MALLOC_CHECK_=2
export MALLOC_CHECK
# Tell GNUstep-base to check for messages sent to deallocated objects
# and crash if it happens.
NSZombieEnabled=YES
CRASH_ON_ZOMBIE=YES
export NSZombieEnabled CRASH_ON_ZOMBIE
echo Running $1...
# Run it. If it terminates abnormally, mark it as a crash (unless we have
# a special file to mark it as being expected to abort).
$MAKE_CMD -s test
if test $? != 0
then
if test -r $NAME.abort
then
echo "Completed file: $1" >&2
else
echo "Failed file: $1 aborted without running all tests!" >&2
if test "$GSTESTMODE" = "failfast"
then
exit 99
fi
fi
else
echo "Completed file: $1" >&2
fi
fi
fi
# Clean up any core dump.