mirror of
https://github.com/gnustep/tools-make.git
synced 2025-06-01 09:42:00 +00:00
Add (untested) support for Objective-C++
Implement parallel build so that all the tests in a directory should be built simultaneously making more effective use of multiprocessor systems. Add the --sequential command line option to disable this if desired. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32367 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
aa9754980c
commit
8d7a59ebf0
5 changed files with 101 additions and 45 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2011-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* TestFramework/example9.m: Fix include
|
||||||
|
* TestFramework/example8.m: Fix include
|
||||||
|
* TestFramework/gnustep-tests.in:
|
||||||
|
* TestFramework/README:
|
||||||
|
Add (untested) support for Objective-C++
|
||||||
|
Implement parallel build so that all the tests in a directory should
|
||||||
|
be built simultaneously making more effective use of multiprocessor
|
||||||
|
systems. Add the --sequential command line option to disable this if
|
||||||
|
desired.
|
||||||
|
|
||||||
2011-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
2011-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* TestFramework/Testing.h: Cosmetic improvement ... indent the results
|
* TestFramework/Testing.h: Cosmetic improvement ... indent the results
|
||||||
|
|
|
@ -235,6 +235,10 @@ is included at the start of the generated makefile (if it exists). This allows
|
||||||
all the tests in a suite to use a common makefile fragment to provide
|
all the tests in a suite to use a common makefile fragment to provide
|
||||||
information for all the testsuite.
|
information for all the testsuite.
|
||||||
|
|
||||||
|
Your system should not make any assumption about the order in which test
|
||||||
|
files are built ... the test framework may build many test files in parallel
|
||||||
|
in order to make effective use of multiple processors.
|
||||||
|
|
||||||
For total control, the framework checks to see if a 'GNUmakefile.tests' file
|
For total control, the framework checks to see if a 'GNUmakefile.tests' file
|
||||||
exists in the directory, and if it does it uses that file as a template to
|
exists in the directory, and if it does it uses that file as a template to
|
||||||
create the GNUmakefile rather than using its own make file.
|
create the GNUmakefile rather than using its own make file.
|
||||||
|
@ -243,9 +247,10 @@ tests to be run, and @TESTRULES@ where it wants the rules to build the
|
||||||
tests to be included.
|
tests to be included.
|
||||||
It should also use @GSTESTFLAGS@ where it wants additions flags to tell
|
It should also use @GSTESTFLAGS@ where it wants additions flags to tell
|
||||||
the compiler about the test framework to be substituted.
|
the compiler about the test framework to be substituted.
|
||||||
The GNUmakefile.tests script should build all the tests when it is
|
The GNUmakefile.tests script should build each individual test when it is
|
||||||
invoked without a target, and it should also have a 'clean' target to
|
invoked with that test name as a target, and it should also build all tests
|
||||||
clean up after all tests.
|
if it is invoked without a target, and have a 'clean' target to clean up
|
||||||
|
before and after all tests.
|
||||||
|
|
||||||
|
|
||||||
Ignoring directories
|
Ignoring directories
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#import "Testing.h"
|
#import "Testing.h"
|
||||||
#import <NSFoundation/NSGeometry.h>
|
#import <Foundation/NSRange.h>
|
||||||
|
|
||||||
/* An eighth test ... complex code fragments
|
/* An eighth test ... complex code fragments
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#import "Testing.h"
|
#import "Testing.h"
|
||||||
#import <NSFoundation/NSGeometry.h>
|
#import <Foundation/NSRange.h>
|
||||||
|
|
||||||
/* A ninth test ... skipping unsupported tests
|
/* A ninth test ... skipping unsupported tests
|
||||||
*
|
*
|
||||||
|
|
|
@ -62,14 +62,17 @@ do
|
||||||
--documentation)
|
--documentation)
|
||||||
echo
|
echo
|
||||||
echo "$0: Script to run the GNUstep testsuite"
|
echo "$0: Script to run the GNUstep testsuite"
|
||||||
echo "Usage: gnustep-tests [directory | test1.m [test2.m ...]]"
|
echo "Usage: gnustep-tests [directory | test.m]"
|
||||||
echo "Runs the specified tests, or any in subdirectories of the"
|
echo "Runs the specified test, or any in subdirectories of the"
|
||||||
echo "current directory if no arguments are given."
|
echo "current directory if no arguments are given."
|
||||||
echo "Use 'gnustep-tests --help' for basic help."
|
echo "Use 'gnustep-tests --help' for basic help."
|
||||||
echo
|
echo
|
||||||
cat $GSTESTTOP/README
|
cat $GSTESTTOP/README
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
--sequential)
|
||||||
|
GSSEQUENTIAL=yes
|
||||||
|
;;
|
||||||
--verbose)
|
--verbose)
|
||||||
GSVERBOSE=yes
|
GSVERBOSE=yes
|
||||||
;;
|
;;
|
||||||
|
@ -87,6 +90,7 @@ do
|
||||||
echo "Use 'gnustep-tests --failfast' to stop after the first failure."
|
echo "Use 'gnustep-tests --failfast' to stop after the first failure."
|
||||||
echo "Use 'gnustep-tests --debug' to run gdb for any failed tests."
|
echo "Use 'gnustep-tests --debug' to run gdb for any failed tests."
|
||||||
echo "Use 'gnustep-tests --verbose' for full/detailed log output."
|
echo "Use 'gnustep-tests --verbose' for full/detailed log output."
|
||||||
|
echo "Use 'gnustep-tests --sequential' to disable parallel building."
|
||||||
echo
|
echo
|
||||||
echo "Interpreting the output"
|
echo "Interpreting the output"
|
||||||
echo "-----------------------"
|
echo "-----------------------"
|
||||||
|
@ -179,8 +183,12 @@ then
|
||||||
BARE=`basename $TESTS .m`
|
BARE=`basename $TESTS .m`
|
||||||
if test x"$BARE" = x"$TESTS"
|
if test x"$BARE" = x"$TESTS"
|
||||||
then
|
then
|
||||||
echo "The file '$1' does not have a .m extension ... cannot test."
|
BARE=`basename $TESTS .mm`
|
||||||
exit 1
|
if test x"$BARE" = x"$TESTS"
|
||||||
|
then
|
||||||
|
echo "The file '$1' does not have a .m or .mm extension ... cannot test."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "'$1' is not a directory or a readable source file ... cannot test."
|
echo "'$1' is not a directory or a readable source file ... cannot test."
|
||||||
|
@ -238,39 +246,29 @@ build_and_run ()
|
||||||
rm -rf ./obj
|
rm -rf ./obj
|
||||||
mkdir ./obj
|
mkdir ./obj
|
||||||
BUILD_CMD="$CC -o ./obj/$TESTNAME $TESTFILE $GSTESTFLAGS $GSTESTLIBS"
|
BUILD_CMD="$CC -o ./obj/$TESTNAME $TESTFILE $GSTESTFLAGS $GSTESTLIBS"
|
||||||
CLEAN_CMD=echo
|
|
||||||
else
|
else
|
||||||
BUILD_CMD="$MAKE_CMD $MAKEFLAGS debug=yes"
|
BUILD_CMD="$MAKE_CMD $MAKEFLAGS debug=yes $TESTNAME"
|
||||||
CLEAN_CMD="$MAKE_CMD clean"
|
|
||||||
# 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
|
|
||||||
TESTRULES="${TESTNAME}_OBJC_FILES=$TESTFILE"
|
|
||||||
if test "$GSTESTMODE" = "failfast"
|
|
||||||
then
|
|
||||||
sed -e "s/@TESTNAMES@/$TESTNAME/;s/@TESTRULES@/$TESTRULES/;s^@TESTFLAGS@^-I$GSTESTTOP -DFAILFAST=1^" < "$TEMPLATE" > GNUmakefile
|
|
||||||
else
|
|
||||||
sed -e "s/@TESTNAMES@/$TESTNAME/;s/@TESTRULES@/$TESTRULES/;s^@TESTFLAGS@^-I$GSTESTTOP^" < "$TEMPLATE" > GNUmakefile
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$GSTESTMODE" = "clean"
|
if test "$GSTESTMODE" = "clean"
|
||||||
then
|
then
|
||||||
$CLEAN_CMD >/dev/null 2>&1
|
|
||||||
rm -f GNUmakefile
|
rm -f GNUmakefile
|
||||||
rm -rf obj core gdb.cmds
|
rm -rf obj core gdb.cmds
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up to avoid contamination by previous tests. Assume
|
# Compile it if necessary.
|
||||||
# that this will never fail in any interesting way.
|
# Redirect errors to stdout so it shows up in the log,
|
||||||
$CLEAN_CMD >/dev/null 2>&1
|
|
||||||
|
|
||||||
# Compile it. Redirect errors to stdout so it shows up in the log,
|
|
||||||
# but not in the summary.
|
# but not in the summary.
|
||||||
$BUILD_CMD >$GSTESTLOG.tmp 2>&1
|
if test "$NEEDBUILD" = "yes"
|
||||||
if test $? != 0
|
then
|
||||||
|
$BUILD_CMD >$GSTESTLOG.tmp 2>&1
|
||||||
|
BUILDSTATUS=$?
|
||||||
|
else
|
||||||
|
BUILDSTATUS=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $BUILDSTATUS != 0
|
||||||
then
|
then
|
||||||
echo "Failed build: $1" >&2
|
echo "Failed build: $1" >&2
|
||||||
if test "$GSTESTMODE" = "failfast"
|
if test "$GSTESTMODE" = "failfast"
|
||||||
|
@ -384,7 +382,7 @@ for TESTDIR in $TESTDIRS
|
||||||
do
|
do
|
||||||
found=no
|
found=no
|
||||||
# Get the names of all subdirectories containing source files.
|
# Get the names of all subdirectories containing source files.
|
||||||
SRCDIRS=`find $TESTDIR -name \*.m | sed -e 's;/[^/]*$;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
SRCDIRS=`find $TESTDIR \( -name "*.m" -o -name "*.mm" \) | sed -e 's;/[^/]*$;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
||||||
if test x"$SRCDIRS" = x
|
if test x"$SRCDIRS" = x
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
|
@ -410,35 +408,76 @@ do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get the names of all the .m and .mm files in the curret directory.
|
||||||
if test x"$TESTS" = x
|
if test x"$TESTS" = x
|
||||||
then
|
then
|
||||||
TESTS=`echo *.m | sort | sed -e 's/\(^\| \)X[^ ]*//g'`
|
TESTS=`find . -maxdepth 1 \( -name "*.m" -o -name "*.mm" \) | sed -e 's;^.*/;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
||||||
fi
|
|
||||||
# If there is a GNUmakefile.tests in the directory, run it first.
|
|
||||||
if test -f GNUmakefile.tests
|
|
||||||
then
|
|
||||||
if test "$GSTESTMODE" = "clean"
|
|
||||||
then
|
|
||||||
$MAKE_CMD -f GNUmakefile.tests $MAKEFLAGS clean 2>&1
|
|
||||||
else
|
|
||||||
$MAKE_CMD -f GNUmakefile.tests $MAKEFLAGS debug=yes 2>&1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -r GNUmakefile.tests
|
if test -r GNUmakefile.tests
|
||||||
then
|
then
|
||||||
|
# There's a custom make template present ... use it.
|
||||||
TEMPLATE=GNUmakefile.tests
|
TEMPLATE=GNUmakefile.tests
|
||||||
elif test -r GNUmakefile.preamble
|
elif test -r GNUmakefile.preamble
|
||||||
then
|
then
|
||||||
|
# There's a make preamble present ... use default template.
|
||||||
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
||||||
elif test -r GNUmakefile.postamble
|
elif test -r GNUmakefile.postamble
|
||||||
then
|
then
|
||||||
|
# There's a make postamble present ... use default template.
|
||||||
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
||||||
elif test -r ../GNUmakefile.super
|
elif test -r ../GNUmakefile.super
|
||||||
then
|
then
|
||||||
|
# There's a make superfile present ... use default template.
|
||||||
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
||||||
else
|
elif test -r "$TESTS"
|
||||||
|
then
|
||||||
|
# Single readable file ... quicker to compile directly than with template
|
||||||
TEMPLATE=
|
TEMPLATE=
|
||||||
|
elif test x"$GSSEQUENTIAL" = xyes
|
||||||
|
then
|
||||||
|
# We don't want to build in parallel, so a makefile won't speed us up
|
||||||
|
TEMPLATE=
|
||||||
|
else
|
||||||
|
# There are multiple files to build ... use make for parallelisation
|
||||||
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
||||||
|
fi
|
||||||
|
|
||||||
|
NEEDBUILD=yes
|
||||||
|
if test x"$TEMPLATE" = x
|
||||||
|
then
|
||||||
|
rm -rf core obj GNUmakefile gdb.cmds
|
||||||
|
else
|
||||||
|
TESTNAMES=
|
||||||
|
TESTRULES=
|
||||||
|
for TESTFILE in $TESTS
|
||||||
|
do
|
||||||
|
tmp=`basename $TESTFILE .m`
|
||||||
|
if test x"$tmp" = x"$TESTFILE"
|
||||||
|
then
|
||||||
|
tmp=`basename $TESTFILE .mm`
|
||||||
|
TESTRULES="$TESTRULES\n${tmp}_OBJCC_FILES=$TESTFILE"
|
||||||
|
else
|
||||||
|
TESTRULES="$TESTRULES\n${tmp}_OBJC_FILES=$TESTFILE"
|
||||||
|
fi
|
||||||
|
TESTNAMES="$TESTNAMES $tmp"
|
||||||
|
done
|
||||||
|
if test "$GSTESTMODE" = "failfast"
|
||||||
|
then
|
||||||
|
sed -e "s/@TESTNAMES@/$TESTNAMES/;s/@TESTRULES@/$TESTRULES/;s^@TESTFLAGS@^-I$GSTESTTOP -DFAILFAST=1^" < "$TEMPLATE" > GNUmakefile
|
||||||
|
else
|
||||||
|
sed -e "s/@TESTNAMES@/$TESTNAMES/;s/@TESTRULES@/$TESTRULES/;s^@TESTFLAGS@^-I$GSTESTTOP^" < "$TEMPLATE" > GNUmakefile
|
||||||
|
fi
|
||||||
|
$MAKE_CMD clean >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Try building all the test files in the directory in parallel.
|
||||||
|
# If that works, set NEEDBUILD to 'yes' so that we will try each
|
||||||
|
# individual test file later.
|
||||||
|
$MAKE_CMD $MAKEFLAGS -j debug=yes >/dev/null 2>&1
|
||||||
|
if test $? = 0
|
||||||
|
then
|
||||||
|
NEEDBUILD=no
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now we process each test file in turn.
|
# Now we process each test file in turn.
|
||||||
|
@ -461,7 +500,7 @@ do
|
||||||
rm -f tests.log tests.sum
|
rm -f tests.log tests.sum
|
||||||
rm -f oldtests.log oldtests.sum
|
rm -f oldtests.log oldtests.sum
|
||||||
else
|
else
|
||||||
# And perform the cleanup script.
|
# And perform the directory end script.
|
||||||
if test -r ./End.sh -a -x ./End.sh
|
if test -r ./End.sh -a -x ./End.sh
|
||||||
then
|
then
|
||||||
./End.sh
|
./End.sh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue