improve summary handling

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32192 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-02-16 09:46:28 +00:00
parent 2d02dc0f97
commit 75e1c29fda
6 changed files with 133 additions and 90 deletions

View file

@ -1,18 +1,19 @@
2011-01-16 Richard Frith-Macdonald <rfm@gnu.org>
* TestFramework/Testing.h:
* TestFramework/gnustep-tests:
* TestFramework/example1.m:
* TestFramework/example2.m:
* TestFramework/example3.m:
* TestFramework/example4.m:
* TestFramework/example5.m:
* TestFramework/GNUmakefile.in:
* TestFramework/example6.m:
* TestFramework/runtest.sh:
* TestFramework/README:
* TestFramework/example7.m:
* TestFramework/example8.m:
* TestFramework/GNUmakefile.in:
* TestFramework/gnustep-tests:
* TestFramework/README:
* TestFramework/runtest.sh:
* TestFramework/Summary.sh:
* TestFramework/Testing.h:
Further cleanups, corrections, simplifications, and documentation
improvements.
Added --failfast option to terminate a test run at the first failure.

View file

@ -75,6 +75,7 @@ makedir = $(DESTDIR)@GNUSTEP_MAKEFILES@
mandir = $(DESTDIR)@GNUSTEP_SYSTEM_DOC_MAN@
srcdir = @srcdir@
VPATH = @srcdir@
testdir=$(makedir)/TestFramework
override GNUSTEP_IS_FLATTENED = @GNUSTEP_IS_FLATTENED@
override GNUSTEP_TARGET_CPU = @clean_target_cpu@
@ -178,7 +179,7 @@ install: generated-files
"$(makedir)/Instance" \
"$(makedir)/Instance/Shared" \
"$(makedir)/Instance/Documentation" \
"$(makedir)/TestFramework")
"$(testdir)")
$(EC)(echo "Installing GNUstep configuration file in $(GNUSTEP_CONFIG_FILE)"; \
"$(srcdir)/mkinstalldirs" "$(GNUSTEP_CONFIG_FILE_DIR)"; \
$(INSTALL_DATA) $(GNUSTEP_DOT_CONF_FILE) "$(GNUSTEP_CONFIG_FILE)")
@ -227,10 +228,11 @@ install: generated-files
$(INSTALL_DATA) config.make "$(makedir)/$(GNUSTEP_TARGET_LDIR)")
$(EC)(echo "Installing Test Framework scripts"; \
$(INSTALL_PROGRAM) -m 755 TestFramework/gnustep-tests "$(tooldir)"; \
$(INSTALL_PROGRAM) -m 755 TestFramework/runtest.sh "$(makedir)/TestFramework")
$(INSTALL_PROGRAM) -m 755 TestFramework/runtest.sh "$(testdir)"; \
$(INSTALL_PROGRAM) -m 755 TestFramework/Summary.sh "$(testdir)")
$(EC)(echo "Installing Test Framework support files"; \
for f in $(TEST_FRAMEWORK_FILES); do \
$(INSTALL_DATA) "$(srcdir)/TestFramework/$$f" "$(makedir)/TestFramework"; \
$(INSTALL_DATA) "$(srcdir)/TestFramework/$$f" "$(testdir)"; \
done)
$(EC)(echo "Installing (and compressing) manpages"; \
"$(srcdir)/mkinstalldirs" "$(mandir)/man1" \
@ -276,7 +278,8 @@ uninstall:
rm -f "$(tooldir)/opentool"; \
rm -f "$(tooldir)/gnustep-config"; \
rm -f "$(tooldir)/gnustep-tests"; \
rm -f "$(makedir)/TestFramework/runtest.sh"; \
rm -f "$(testdir)/runtest.sh"; \
rm -f "$(testdir)/Summary.sh"; \
for f in $(MAKE_FILES); do \
rm -f "$(makedir)/$$f"; \
done
@ -293,7 +296,7 @@ uninstall:
rm -f "$(makedir)/Instance/Documentation/$$f"; \
done
for f in $(TEST_FRAMEWORK_FILES); do \
rm -f "$(makedir)/TestFramework/$$f"; \
rm -f "$(testdir)/$$f"; \
done
rm -f "$(makedir)/executable.template"
rm -f "$(makedir)/app-wrapper.template"
@ -305,7 +308,7 @@ uninstall:
rm -f "$(makedir)/$(GNUSTEP_TARGET_LDIR)/config.make"
rm -f "$(GNUSTEP_CONFIG_FILE)"
-rmdir "$(GNUSTEP_CONFIG_FILE_DIR)"
-rmdir "$(makedir)/TestFramework"
-rmdir "$(testdir)"
-rmdir "$(makedir)/Instance/Documentation"
-rmdir "$(makedir)/Instance/Shared"
-rmdir "$(makedir)/Instance"

View file

@ -261,3 +261,9 @@ which would confuse the test framework at the point when it analyses the
log ... so you need to avoid starting a line with any of the special
phrases generated to mark a passed test or a particular type of failure.
If a Summary.sh file is present in a test directory and gnustep-tests is
used to run just those tests in that directory, the shell script will be
executed in order to provide the summary of the test results. In all other
cases the summary is done by the Summary.sh script provided in the test
framework.

95
TestFramework/Summary.sh Normal file
View file

@ -0,0 +1,95 @@
#!/bin/sh
#
# Script to generate summary/advice based on the datain tests.sum
#
# Authors of individual testsuites may supply their own implementation
# of Summary.sh to be used if someone runs their test framework.
#
# The script may examine the contents of tests.sum (containing totals of
# each kind of test result) or tests.log (the full testrun log) to decide
# what sort of summary to present.
#
# The script may also use the value of the GSTESTMODE variable to decide
# what it does.
#
if [ "$GSTESTMODE" = "clean" ]
then
exit 0
fi
grep -q "\(Failed set\|Failed sets\|Failed test\|Failed tests\|Failed build\|Failed build\|Failed file\|Failed files\)$" tests.sum
if [ $? = 1 ]
then
echo "All OK!"
grep -q "\(Dashed hope\|Dashed hopes\)$" tests.sum
if [ $? = 0 ]
then
echo
echo "But we were hoping that even more tests might have passed if"
echo "someone had added support for them to the package. If you"
echo "would like to help, please contact the package maintainer."
fi
grep -q "\(Skipped set\|Skipped sets\)$" tests.sum
if [ $? = 0 ]
then
echo
echo "Even though no tests failed, we had to skip some testing"
echo "due to lack of support on your system. This might be because"
echo "some required software library was just not available when the"
echo "software was built (in which case you can install that library"
echo "and rebuild, then re-run the tests), or the required functions"
echo "may not be available on your operating system at all."
echo "If you would like to contribute code to add the missing"
echo "functionality, please contact the package maintainer."
fi
else
if [ "$GSTESTMODE" = "failfast" ]
then
exit 0
fi
grep -q "\(Failed build\|Failed build\)$" tests.sum
if [ $? = 0 ]
then
echo
echo "Unfortunately we could not even compile all the test programs."
echo "This means that the test could not be run properly, and you need"
echo "to try to figure out why and fix it or ask for help."
fi
grep -q "\(Failed file\|Failed files\)$" tests.sum
if [ $? = 0 ]
then
echo
echo "Some testing was abandoned when a test program aborted. This is"
echo "generally a severe problem and may nean that the package is"
echo "completely unusuable. You need to try to fix this and, if it's"
echo "not due to some problem on your system, please help by submitting"
echo "a patch (or at least a bug report) to the package maintainer."
fi
grep -q "\(Failed set\|Failed sets\)$" tests.sum
if [ $? = 0 ]
then
echo
echo "Some set of tests failed. This could well mean that a large"
echo "number of individual tests dis not pass and that there are"
echo "severe problems in the software."
echo "Please submit a patch to fix the problem or send a bug report to"
echo "the package maintainer."
fi
grep -q "\(Failed test\|Failed tests\)$" tests.sum
if [ $? = 0 ]
then
echo
echo "One or more tests failed. None of them should have."
echo "Please submit a patch to fix the problem or send a bug report to"
echo "the package maintainer."
fi
fi

View file

@ -94,6 +94,8 @@ do
shift
done
export GSTESTMODE
if [ ! "$MAKE_CMD" ]
then
gmake --version > /dev/null 2>&1
@ -204,6 +206,7 @@ then
mv tests.sum oldtests.sum
fi
SUMD=.
if [ x"$TESTDIRS" = x ]
then
# Run specific individual test files.
@ -218,6 +221,7 @@ then
else
for dir in $TESTDIRS
do
SUMD=$dir
TESTS=`find $dir -name \*.m | sort | sed -e 's/\(^\| \)X[^ ]*//g'`
# If there are no test files found, we need to print out a message
@ -264,7 +268,7 @@ fi
if [ "$GSTESTMODE" = "clean" ]
then
rm -f tests.tmp tests.sum.tmp
rm -f GNUmakefile.tmp tests.tmp tests.sum.tmp
rm -f tests.log tests.sum
rm -f oldtests.log oldtests.sum
else
@ -291,84 +295,18 @@ else
cat tests.tmp
echo
grep -q "\(Failed set\|Failed sets\|Failed test\|Failed tests\|Failed build\|Failed build\|Failed file\|Failed files\)$" tests.tmp
if [ $? = 1 ]
then
echo "All OK!"
grep -q "\(Dashed hope\|Dashed hopes\)$" tests.tmp
if [ $? = 0 ]
then
echo
echo "But we were hoping that even more tests might have passed if"
echo "someone had added support for them to the package. If you"
echo "would like to help, please contact the package maintainer."
fi
grep -q "\(Skipped set\|Skipped sets\)$" tests.tmp
if [ $? = 0 ]
then
echo
echo "Even though no tests failed, we had to skip some testing"
echo "due to lack of support on your system. This might be because"
echo "some required software library was just not available when the"
echo "software was built (in which case you can install that library"
echo "and rebuild, then re-run the tests), or the required functions"
echo "may not be available on your operating system at all."
echo "If you would like to contribute code to add the missing"
echo "functionality, please contact the package maintainer."
fi
else
if [ "$GSTESTMODE" = "failfast" ]
then
exit 0
fi
grep -q "\(Failed build\|Failed build\)$" tests.tmp
if [ $? = 0 ]
then
echo
echo "Unfortunately we could not even compile all the test programs."
echo "This means that the test could not be run properly, and you need"
echo "to try to figure out why and fix it or ask for help."
fi
grep -q "\(Failed file\|Failed files\)$" tests.tmp
if [ $? = 0 ]
then
echo
echo "Some testing was abandoned when a test program aborted. This is"
echo "generally a severe problem and may nean that the package is"
echo "completely unusuable. You need to try to fix this and, if it's"
echo "not due to some problem on your system, please help by submitting"
echo "a patch (or at least a bug report) to the package maintainer."
fi
grep -q "\(Failed set\|Failed sets\)$" tests.tmp
if [ $? = 0 ]
then
echo
echo "Some set of tests failed. This could well mean that a large"
echo "number of individual tests dis not pass and that there are"
echo "severe problems in the software."
echo "Please submit a patch to fix the problem or send a bug report to"
echo "the package maintainer."
fi
grep -q "\(Failed test\|Failed tests\)$" tests.tmp
if [ $? = 0 ]
then
echo
echo "One or more tests failed. None of them should have."
echo "Please submit a patch to fix the problem or send a bug report to"
echo "the package maintainer."
fi
fi
echo
fi
# In the case where we ran a single testsuite, we allow the Summary.sh
# script in that testsuite to generate our summary.
if [ x"$TESTDIRS" = x"$SUMD" -a -r $SUMD/Summary.sh -a -x $SUMD/Summary.sh ]
then
RUNCMD=$SUMD/Summary.sh
else
RUNCMD=$GNUSTEP_MAKEFILES/TestFramework/Summary.sh
fi
$RUNCMD
# Delete the temporary file.
rm -f tests.tmp tests.sum.tmp

View file

@ -134,9 +134,9 @@ then
# option if needed.
if [ "$GSTESTMODE" = "failfast" ]
then
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@/-DFAILFAST=1/;s^@INCLUDEDIR@^$TOP^" < $TOP/GNUmakefile.in > GNUmakefile.tmp
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@/-DFAILFAST=1/;s^@INCLUDEDIR@^$TOP^" < $TEMPLATE > GNUmakefile.tmp
else
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@//;s^@INCLUDEDIR@^$TOP^" < $TOP/GNUmakefile.in > GNUmakefile.tmp
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$NAME/;s/@FAILFAST@//;s^@INCLUDEDIR@^$TOP^" < $TEMPLATE > GNUmakefile.tmp
fi
rm -f GNUmakefile.bck