2011-02-22 10:24:10 +00:00
|
|
|
#!@SHELLPROG@
|
2011-02-07 20:41:58 +00:00
|
|
|
#
|
|
|
|
# Runs tests for the GNUstep Testsuite
|
|
|
|
#
|
|
|
|
# Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# Written by: Alexander Malmberg <alexander@malmberg.org>
|
|
|
|
# Updates by: Richard Frith-Macdonald <rfm@gnu.org>
|
|
|
|
#
|
|
|
|
# This package is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 3 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
#
|
2011-02-20 09:34:47 +00:00
|
|
|
# Usage: gnustep-tests [directory | test.m]
|
2011-02-07 20:41:58 +00:00
|
|
|
#
|
2011-02-20 09:34:47 +00:00
|
|
|
# Runs the tests in the specified directory (or those in the individual file)
|
2011-02-07 20:41:58 +00:00
|
|
|
# or all the tests in subdirectories of the current directory if no arguments
|
|
|
|
# are given.
|
|
|
|
# A summary is written to tests.sum, a log to tests.log, and a brief
|
|
|
|
# summary to stdout.
|
|
|
|
# The log and summary from the previous testrun are renamed to
|
|
|
|
# oldtests.log and oldtests.sum, available for comparison.
|
2015-10-26 10:20:06 +00:00
|
|
|
# The exit value of the script is 0 if there are no failures, 1 otherwise.
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2023-12-12 19:58:02 +00:00
|
|
|
if test "@MISSINGBASH@" = "YES"; then
|
2023-12-12 20:06:02 +00:00
|
|
|
echo "gnustep-make was unable to find bash at configure time."
|
|
|
|
echo "The test framework cannot run without bash installed."
|
|
|
|
echo "Please install bash and reconfigure/reinstall gnustep-make."
|
2023-12-12 19:58:02 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2011-02-07 20:41:58 +00:00
|
|
|
if test -z "$GNUSTEP_MAKEFILES"; then
|
|
|
|
GNUSTEP_MAKEFILES=`gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null`
|
|
|
|
if test -z "$GNUSTEP_MAKEFILES"; then
|
|
|
|
echo "You need to have GNUstep-make installed and set up."
|
|
|
|
echo "Did you remember to source GNUstep.sh?"
|
|
|
|
else
|
2011-02-12 11:31:26 +00:00
|
|
|
echo "You forgot to set your GNUSTEP_MAKEFILES environment variable."
|
|
|
|
echo "Setting it to $GNUSTEP_MAKEFILES during this test run."
|
2011-02-07 20:41:58 +00:00
|
|
|
export GNUSTEP_MAKEFILES
|
|
|
|
. $GNUSTEP_MAKEFILES/GNUstep.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-02-21 09:26:43 +00:00
|
|
|
GSTESTTOP="$GNUSTEP_MAKEFILES/TestFramework"
|
|
|
|
export GSTESTTOP
|
2011-02-22 09:16:18 +00:00
|
|
|
GSTESTDIR=`pwd`
|
|
|
|
export GSTESTDIR
|
2011-02-21 09:26:43 +00:00
|
|
|
|
2011-02-16 05:44:45 +00:00
|
|
|
GSTESTMODE=normal
|
2011-02-13 08:05:06 +00:00
|
|
|
|
2023-01-09 22:30:22 +00:00
|
|
|
GSMAKEOPTIONS="debug=yes"
|
|
|
|
GSVERBOSECFLAG=
|
|
|
|
|
2011-02-07 20:41:58 +00:00
|
|
|
# Argument checking
|
|
|
|
while test $# != 0
|
|
|
|
do
|
|
|
|
gs_option=
|
|
|
|
case $1 in
|
2011-02-13 08:05:06 +00:00
|
|
|
--clean)
|
2011-02-16 05:44:45 +00:00
|
|
|
GSTESTMODE=clean
|
2011-02-13 08:05:06 +00:00
|
|
|
;;
|
2011-04-08 17:07:41 +00:00
|
|
|
--debug)
|
2011-02-22 09:16:18 +00:00
|
|
|
GSTESTDBG="$GSTESTDIR/gdb.cmds"
|
|
|
|
;;
|
2023-01-09 22:30:22 +00:00
|
|
|
--make-debug)
|
|
|
|
GSMAKEOPTIONS+=" --debug"
|
|
|
|
;;
|
|
|
|
--make-no-silent)
|
|
|
|
GSMAKEOPTIONS+=" --no-silent"
|
|
|
|
;;
|
2011-04-08 17:07:41 +00:00
|
|
|
--developer)
|
2011-03-14 08:39:07 +00:00
|
|
|
GSTESTDEV=yes
|
|
|
|
;;
|
2011-02-12 11:31:26 +00:00
|
|
|
--documentation)
|
|
|
|
echo
|
|
|
|
echo "$0: Script to run the GNUstep testsuite"
|
2011-02-25 17:42:21 +00:00
|
|
|
echo "Usage: gnustep-tests [directory | test.m]"
|
|
|
|
echo "Runs the specified test, or any in subdirectories of the"
|
2011-02-12 11:31:26 +00:00
|
|
|
echo "current directory if no arguments are given."
|
|
|
|
echo "Use 'gnustep-tests --help' for basic help."
|
|
|
|
echo
|
2011-02-21 09:26:43 +00:00
|
|
|
cat $GSTESTTOP/README
|
2011-02-12 11:31:26 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2011-02-25 17:42:21 +00:00
|
|
|
--sequential)
|
|
|
|
GSSEQUENTIAL=yes
|
|
|
|
;;
|
2021-02-15 09:52:22 +00:00
|
|
|
--notimestamps)
|
|
|
|
GSTEST_TS=0
|
|
|
|
;;
|
2011-02-23 09:10:39 +00:00
|
|
|
--verbose)
|
|
|
|
GSVERBOSE=yes
|
2023-01-09 22:30:22 +00:00
|
|
|
GSMAKEOPTIONS+=" messages=yes"
|
|
|
|
GSVERBOSECFLAG="-v"
|
2011-02-23 09:10:39 +00:00
|
|
|
;;
|
2011-02-16 05:44:45 +00:00
|
|
|
--failfast)
|
|
|
|
GSTESTMODE=failfast
|
|
|
|
;;
|
2011-02-07 20:41:58 +00:00
|
|
|
--help | -h)
|
|
|
|
echo
|
|
|
|
echo "$0: Script to run the GNUstep testsuite"
|
2011-02-20 09:34:47 +00:00
|
|
|
echo "Usage: gnustep-tests [directory | test.m]]"
|
2011-02-08 11:23:26 +00:00
|
|
|
echo "Runs the specified tests, or any in subdirectories of the"
|
2011-02-07 20:41:58 +00:00
|
|
|
echo "current directory if no arguments are given."
|
2011-02-12 11:31:26 +00:00
|
|
|
echo "Use 'gnustep-tests --documentation' for full details."
|
2011-02-13 08:08:53 +00:00
|
|
|
echo "Use 'gnustep-tests --clean' to remove old logs and leftover files."
|
2011-02-22 09:16:18 +00:00
|
|
|
echo "Use 'gnustep-tests --failfast' to stop after the first failure."
|
2023-01-09 22:30:22 +00:00
|
|
|
echo "Use 'gnustep-tests --debug' to run gdb/lldb for any failed tests."
|
|
|
|
echo "Use 'gnustep-tests --make-debug' to enable make debug output."
|
|
|
|
echo "Use 'gnustep-tests --make-no-silent' to disable silent make output."
|
2011-03-14 08:39:07 +00:00
|
|
|
echo "Use 'gnustep-tests --developer' to treat hopes as real tests."
|
2011-02-23 09:10:39 +00:00
|
|
|
echo "Use 'gnustep-tests --verbose' for full/detailed log output."
|
2011-02-25 17:42:21 +00:00
|
|
|
echo "Use 'gnustep-tests --sequential' to disable parallel building."
|
2021-02-15 09:52:22 +00:00
|
|
|
echo "Use 'gnustep-tests --notimestamps' to disable testcase timestamps."
|
2011-02-07 20:41:58 +00:00
|
|
|
echo
|
|
|
|
echo "Interpreting the output"
|
|
|
|
echo "-----------------------"
|
|
|
|
echo "The summary output lists all test failures ... there should not"
|
|
|
|
echo "be any. If a test fails then either there is a problem in the"
|
2011-02-08 11:23:26 +00:00
|
|
|
echo "software being tested, or a problem in the test itself. Either"
|
2011-02-07 20:41:58 +00:00
|
|
|
echo "way, you should try to fix the problem and provide a patch, or"
|
|
|
|
echo "at least report it at: https://savannah.gnu.org/bugs/?group=gnustep"
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2011-02-16 09:46:28 +00:00
|
|
|
export GSTESTMODE
|
2011-02-19 16:46:10 +00:00
|
|
|
GSTESTLOG=$GSTESTDIR/tests.log
|
|
|
|
export GSTESTLOG
|
|
|
|
GSTESTSUM=$GSTESTDIR/tests.sum
|
|
|
|
export GSTESTSUM
|
2011-02-16 09:46:28 +00:00
|
|
|
|
2011-03-29 13:51:14 +00:00
|
|
|
# We assume that the C compiler supports ObjC
|
2011-02-21 09:26:43 +00:00
|
|
|
if test x"$CC" = x
|
|
|
|
then
|
|
|
|
CC=`gnustep-config --variable=CC`
|
|
|
|
export CC
|
|
|
|
fi
|
2011-03-13 12:59:48 +00:00
|
|
|
|
2011-04-08 23:45:48 +00:00
|
|
|
# The C++/ObjC++ tests are currently enabled only if you do 'make
|
|
|
|
# check GNUSTEP_TEST_OBJCXX=yes'.
|
|
|
|
if test x"$GNUSTEP_TEST_OBJCXX" = x"yes"
|
2011-03-21 08:48:20 +00:00
|
|
|
then
|
2011-04-08 23:45:48 +00:00
|
|
|
# Determine the ObjC++ compiler to use. Either it was supplied
|
|
|
|
# in the environment or command-line by setting the variable
|
|
|
|
# OBJCXX, or we'll use the default configured in gnustep-make.
|
|
|
|
if test x"$OBJCXX" = x
|
|
|
|
then
|
|
|
|
OBJCXX=`gnustep-config --variable=OBJCXX`
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test x"$OBJCXX" = x
|
|
|
|
then
|
|
|
|
echo "Warning: You asked to run the Objective-C++ testcases, but no Objective-C++ compiler was found."
|
|
|
|
echo " Objective-C++ testcases will not be ignored."
|
|
|
|
echo " Try setting OBJCXX to your Objective-C++ compiler to fix this."
|
|
|
|
else
|
|
|
|
# Set the CXX variable which is the one actually used by gnustep-make
|
|
|
|
# to compile and link ObjC++.
|
|
|
|
CXX="$OBJCXX"
|
|
|
|
export CXX
|
|
|
|
fi
|
2011-03-29 13:51:14 +00:00
|
|
|
else
|
2011-04-08 23:45:48 +00:00
|
|
|
OBJCXX=
|
2011-03-21 08:48:20 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-15 10:00:44 +00:00
|
|
|
if test x"$GSTEST_TS" = x"0"
|
2021-02-15 09:52:22 +00:00
|
|
|
then
|
|
|
|
GSTESTFLAGS="-DTEST_TS=0"
|
|
|
|
else
|
|
|
|
GSTESTFLAGS="-DTEST_TS=1"
|
|
|
|
fi
|
2011-02-21 09:26:43 +00:00
|
|
|
if test "$GSTESTMODE" = "failfast"
|
2011-03-14 08:39:07 +00:00
|
|
|
then
|
|
|
|
if test x"$GSTESTDEV" = x"yes"
|
|
|
|
then
|
2021-02-15 09:52:22 +00:00
|
|
|
GSTESTFLAGS="$GSTESTFLAGS -DTESTDEV=1 -DFAILFAST=1"
|
2011-03-14 08:39:07 +00:00
|
|
|
else
|
2021-02-15 09:52:22 +00:00
|
|
|
GSTESTFLAGS="$GSTESTFLAGS -DFAILFAST=1"
|
2011-03-14 08:39:07 +00:00
|
|
|
fi
|
|
|
|
elif test x"$GSTESTDEV" = x"yes"
|
|
|
|
then
|
2021-02-15 09:52:22 +00:00
|
|
|
GSTESTFLAGS="$GSTESTFLAGS -DTESTDEV=1"
|
2011-03-14 08:39:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test x"$GSTESTFLAGS" != x
|
2011-02-21 09:26:43 +00:00
|
|
|
then
|
2011-03-13 12:59:48 +00:00
|
|
|
#
|
2011-03-14 08:39:07 +00:00
|
|
|
# We need to add flags to all the code we build.
|
|
|
|
# We do this by using the ADDITIONAL_?FLAGS
|
2011-03-13 12:59:48 +00:00
|
|
|
# environment variables supported by gnustep-make.
|
|
|
|
#
|
2011-03-14 08:39:07 +00:00
|
|
|
ADDITIONAL_OBJCFLAGS="$GSTESTFLAGS $ADDITIONAL_OBJCFLAGS"
|
2011-03-13 12:59:48 +00:00
|
|
|
export ADDITIONAL_OBJCFLAGS
|
2011-03-14 08:39:07 +00:00
|
|
|
ADDITIONAL_OBJCCFLAGS="$GSTESTFLAGS $ADDITIONAL_OBJCCFLAGS"
|
2011-03-13 12:59:48 +00:00
|
|
|
export ADDITIONAL_OBJCCFLAGS
|
2011-02-21 09:26:43 +00:00
|
|
|
fi
|
2011-03-13 12:59:48 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# We insert our header directory as the first additional header directory
|
|
|
|
# so that the test header files are found before any others.
|
|
|
|
#
|
|
|
|
ADDITIONAL_INCLUDE_DIRS="-I$GSTESTTOP $ADDITIONAL_INCLUDE_DIRS"
|
|
|
|
export ADDITIONAL_INCLUDE_DIRS
|
|
|
|
|
|
|
|
GSTESTFLAGS=`gnustep-config --debug-flags`
|
2011-02-21 09:26:43 +00:00
|
|
|
GSTESTLIBS=`gnustep-config --gui-libs`
|
2011-03-01 12:39:09 +00:00
|
|
|
GSTESTOPTS="GNUSTEP_OBJ_DIR=./obj"
|
2011-02-21 18:48:39 +00:00
|
|
|
|
|
|
|
if test x"$BASH_VERSION" = x
|
|
|
|
then
|
|
|
|
# In some shells the built in test command actually only implements a subset
|
|
|
|
# of the normally expected functionality (or is partially broken), so we
|
|
|
|
# define a function to call a real program to do the job.
|
|
|
|
test()
|
|
|
|
{
|
2011-02-22 10:24:10 +00:00
|
|
|
@TESTPROG@ $@
|
2011-02-21 18:48:39 +00:00
|
|
|
}
|
|
|
|
fi
|
2011-02-21 09:26:43 +00:00
|
|
|
|
2011-02-19 05:21:40 +00:00
|
|
|
if test ! "$MAKE_CMD"
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
2011-02-18 16:27:22 +00:00
|
|
|
MAKE_CMD=`gnustep-config --variable=GNUMAKE`
|
|
|
|
$MAKE_CMD --version > /dev/null 2>&1
|
2011-02-19 05:21:40 +00:00
|
|
|
if test $? != 0
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
|
|
|
MAKE_CMD=gmake
|
2011-02-18 16:27:22 +00:00
|
|
|
$MAKE_CMD --version > /dev/null 2>&1
|
2011-02-19 05:21:40 +00:00
|
|
|
if test $? != 0
|
2011-02-18 16:27:22 +00:00
|
|
|
then
|
|
|
|
MAKE_CMD=make
|
|
|
|
fi
|
2011-02-07 20:41:58 +00:00
|
|
|
fi
|
|
|
|
fi
|
2011-02-13 08:05:06 +00:00
|
|
|
|
|
|
|
if test $# = 0
|
|
|
|
then
|
|
|
|
echo "Checking for presence of test subdirectories ..."
|
2011-03-01 09:30:29 +00:00
|
|
|
NONAME=yes
|
|
|
|
else
|
|
|
|
NONAME=no
|
2011-02-13 08:05:06 +00:00
|
|
|
fi
|
|
|
|
|
2011-02-07 20:41:58 +00:00
|
|
|
TEMP=`echo *`
|
2011-02-20 09:34:47 +00:00
|
|
|
TESTS=
|
2011-02-07 20:41:58 +00:00
|
|
|
TESTDIRS=
|
|
|
|
for file in $TEMP
|
|
|
|
do
|
2011-02-19 05:21:40 +00:00
|
|
|
if test -d $file -a $file != CVS -a $file != obj
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
|
|
|
TESTDIRS="$TESTDIRS $file"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2011-02-19 05:21:40 +00:00
|
|
|
if test x$1 != x
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
2011-02-19 05:21:40 +00:00
|
|
|
if test -d $1
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
|
|
|
# Only find in the directories specified.
|
|
|
|
TESTDIRS=$*
|
2011-02-22 15:54:26 +00:00
|
|
|
elif test -r $1
|
|
|
|
then
|
2011-02-20 09:34:47 +00:00
|
|
|
TESTDIRS=`dirname $1`
|
2011-02-20 15:07:20 +00:00
|
|
|
TESTS=`basename $1`
|
2011-02-22 15:54:26 +00:00
|
|
|
BARE=`basename $TESTS .m`
|
|
|
|
if test x"$BARE" = x"$TESTS"
|
|
|
|
then
|
2011-02-25 17:42:21 +00:00
|
|
|
BARE=`basename $TESTS .mm`
|
|
|
|
if test x"$BARE" = x"$TESTS"
|
|
|
|
then
|
2013-06-17 06:20:47 +00:00
|
|
|
BARE=`basename $TESTS .c`
|
|
|
|
if test x"$BARE" = x"$TESTS"
|
|
|
|
then
|
|
|
|
BARE=`basename $TESTS .cc`
|
|
|
|
if test x"$BARE" = x"TESTS"
|
|
|
|
then
|
|
|
|
echo "The file '$1' does not end in .m, .mm, .c or .cc ... cannot test."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2011-02-25 17:42:21 +00:00
|
|
|
fi
|
2011-02-22 15:54:26 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "'$1' is not a directory or a readable source file ... cannot test."
|
|
|
|
exit 1
|
2011-02-07 20:41:58 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-02-18 21:47:35 +00:00
|
|
|
# Function for platforms where grep can't search for multiple patterns.
|
|
|
|
extract()
|
|
|
|
{
|
|
|
|
f=$1
|
|
|
|
shift
|
|
|
|
while test $# != 0
|
|
|
|
do
|
2022-12-05 10:58:38 +00:00
|
|
|
grep -a "$1" "$f"
|
2011-02-18 21:47:35 +00:00
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
# Get the name of a test from its file name
|
|
|
|
getname()
|
|
|
|
{
|
|
|
|
TESTNAME=`echo $1 | sed -e"s/^\(test^.]*\)$/\1.obj./;s/\.[^.]*//g"`
|
|
|
|
}
|
|
|
|
|
2011-02-18 21:47:35 +00:00
|
|
|
# Function for platforms where grep can't search for multiple patterns.
|
|
|
|
present()
|
|
|
|
{
|
|
|
|
f=$1
|
|
|
|
shift
|
|
|
|
while test $# != 0
|
|
|
|
do
|
2022-12-05 10:58:38 +00:00
|
|
|
grep -a "$1" "$f" >/dev/null
|
2011-02-19 05:21:40 +00:00
|
|
|
if test $? = "0"
|
2011-02-18 21:47:35 +00:00
|
|
|
then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
# Low level function to build the Objective-C program $TESTFILE
|
|
|
|
# in the current directory. The TEMPLATE variable must already
|
|
|
|
# be set to the name of the make file template if gnustep-make
|
|
|
|
# is to do the building.
|
2011-02-21 18:48:39 +00:00
|
|
|
#
|
2022-01-26 22:16:04 +00:00
|
|
|
build_test ()
|
2011-02-21 18:48:39 +00:00
|
|
|
{
|
2022-01-26 22:16:04 +00:00
|
|
|
# The argument to this function is the name of a test file.
|
2011-02-21 18:48:39 +00:00
|
|
|
# Remove the extension, if there is one. If there is no extension, add
|
|
|
|
# .obj .
|
2022-01-26 22:16:04 +00:00
|
|
|
local TESTFILE=$1
|
|
|
|
local TESTNAME=`echo $TESTFILE | sed -e"s/^\(test^.]*\)$/\1.obj./;s/\.[^.]*//g"`
|
|
|
|
local BUILD_STATUS
|
|
|
|
local BUILD_CMD
|
|
|
|
local tmp
|
2011-02-21 18:48:39 +00:00
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
# Build the test.
|
|
|
|
echo "Building $TESTNAME"
|
2011-02-21 18:48:39 +00:00
|
|
|
|
|
|
|
if test x"$TEMPLATE" = x
|
|
|
|
then
|
|
|
|
# The very simple case, we just need to compile a single file
|
|
|
|
# putting the executable in the obj subdirectory.
|
2011-03-21 08:48:20 +00:00
|
|
|
# We test for a .mm extension to see which compiler to use.
|
2011-02-21 18:48:39 +00:00
|
|
|
rm -rf ./obj
|
|
|
|
mkdir ./obj
|
2011-03-21 08:48:20 +00:00
|
|
|
tmp=`basename $TESTFILE .m`
|
|
|
|
if test x"$tmp" = x"$TESTFILE"
|
|
|
|
then
|
2013-06-17 06:20:47 +00:00
|
|
|
tmp=`basename $TESTFILE .mm`
|
|
|
|
if test x"$tmp" = x"$TESTFILE"
|
|
|
|
then
|
|
|
|
tmp=`basename $TESTFILE .c`
|
|
|
|
if test x"$tmp" = x"$TESTFILE"
|
|
|
|
then
|
2023-01-09 22:30:22 +00:00
|
|
|
BUILD_CMD="$CXX -o $GSVERBOSECFLAG ./obj/$TESTNAME $TESTFILE $ADDITIONAL_CXXFLAGS $ADDITIONAL_LDFLAGS"
|
2013-06-17 06:20:47 +00:00
|
|
|
else
|
2023-01-09 22:30:22 +00:00
|
|
|
BUILD_CMD="$CC -o $GSVERBOSECFLAG ./obj/$TESTNAME $TESTFILE $ADDITIONAL_CFLAGS $ADDITIONAL_LDFLAGS"
|
2013-06-17 06:20:47 +00:00
|
|
|
fi
|
|
|
|
else
|
2023-01-09 22:30:22 +00:00
|
|
|
BUILD_CMD="$OBJCXX -o $GSVERBOSECFLAG ./obj/$TESTNAME $TESTFILE $GSTESTFLAGS $GSTESTLIBS"
|
2013-06-17 06:20:47 +00:00
|
|
|
fi
|
2011-03-22 19:31:27 +00:00
|
|
|
else
|
2023-01-09 22:30:22 +00:00
|
|
|
BUILD_CMD="$CC -o $GSVERBOSECFLAG ./obj/$TESTNAME $TESTFILE $GSTESTFLAGS $GSTESTLIBS"
|
2011-03-21 08:48:20 +00:00
|
|
|
fi
|
2011-02-21 18:48:39 +00:00
|
|
|
else
|
2023-01-09 22:30:22 +00:00
|
|
|
echo $GSMAKEOPTIONS
|
|
|
|
BUILD_CMD="$MAKE_CMD $GSMAKEOPTIONS $TESTNAME"
|
2011-02-21 18:48:39 +00:00
|
|
|
fi
|
|
|
|
|
2011-02-25 17:42:21 +00:00
|
|
|
# Redirect errors to stdout so it shows up in the log,
|
2011-02-21 18:48:39 +00:00
|
|
|
# but not in the summary.
|
2022-01-26 22:16:04 +00:00
|
|
|
echo "Building $dir/$TESTFILE"
|
|
|
|
echo "$BUILD_CMD"
|
|
|
|
if test -r ./make-check.env
|
2011-02-25 17:42:21 +00:00
|
|
|
then
|
2022-03-01 13:57:56 +00:00
|
|
|
( . ./make-check.env; . ./TestInfo > /dev/null 2>&1; $BUILD_CMD) 2>&1
|
2011-02-25 17:42:21 +00:00
|
|
|
else
|
2022-03-01 13:57:56 +00:00
|
|
|
( . ./TestInfo > /dev/null 2>&1; $BUILD_CMD) 2>&1
|
2011-02-25 17:42:21 +00:00
|
|
|
fi
|
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
if test $? != 0
|
2011-02-21 18:48:39 +00:00
|
|
|
then
|
2022-01-26 22:16:04 +00:00
|
|
|
rm -f ./obj/$TESTNAME
|
2011-02-21 18:48:39 +00:00
|
|
|
echo "Failed build: $1" >&2
|
|
|
|
if test "$GSTESTMODE" = "failfast"
|
|
|
|
then
|
|
|
|
return 1
|
|
|
|
fi
|
2022-01-26 22:16:04 +00:00
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
run_test ()
|
|
|
|
{
|
|
|
|
# Remove the extension, if there is one. If there is no extension, add
|
|
|
|
# .obj .
|
|
|
|
local TESTFILE=$1
|
|
|
|
local TESTNAME=$2
|
|
|
|
|
|
|
|
# Run the test.
|
|
|
|
|
|
|
|
local RUN_CMD="./obj/$TESTNAME"
|
|
|
|
|
|
|
|
if test -x $RUN_CMD
|
|
|
|
then
|
2011-02-21 18:48:39 +00:00
|
|
|
# We want aggressive memory checking.
|
|
|
|
|
|
|
|
# Tell glibc to check for malloc errors, and to crash if it detects
|
|
|
|
# any.
|
|
|
|
MALLOC_CHECK_=2
|
2013-03-08 11:56:07 +00:00
|
|
|
export MALLOC_CHECK_
|
2011-02-21 18:48:39 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2011-02-22 12:30:38 +00:00
|
|
|
echo Running $dir/$TESTFILE...
|
2011-02-21 18:48:39 +00:00
|
|
|
# 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).
|
2015-02-03 12:49:58 +00:00
|
|
|
|
2015-10-20 06:44:08 +00:00
|
|
|
# Env.sh is deprecated ... we should only use TestInfo to setup for a test
|
2015-02-03 12:49:58 +00:00
|
|
|
if test -r ./Env.sh
|
|
|
|
then
|
|
|
|
( . ./Env.sh; $RUN_CMD )
|
|
|
|
else
|
2015-10-25 09:17:24 +00:00
|
|
|
if test -r ./make-check.env
|
|
|
|
then
|
2022-03-01 13:57:56 +00:00
|
|
|
( . ./make-check.env; . ./TestInfo > /dev/null 2>&1; $RUN_CMD )
|
2015-10-25 09:17:24 +00:00
|
|
|
else
|
2022-03-01 13:57:56 +00:00
|
|
|
( . ./TestInfo > /dev/null 2>&1; $RUN_CMD )
|
2015-10-25 09:17:24 +00:00
|
|
|
fi
|
2015-02-03 12:49:58 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-16 09:28:34 +00:00
|
|
|
result=$?
|
|
|
|
if test $result != 0
|
2011-02-21 18:48:39 +00:00
|
|
|
then
|
|
|
|
if test -r $TESTFILE.abort
|
|
|
|
then
|
|
|
|
echo "Completed file: $TESTFILE" >&2
|
|
|
|
else
|
|
|
|
echo "Failed file: $TESTFILE aborted without running all tests!" >&2
|
|
|
|
if test "$GSTESTMODE" = "failfast"
|
|
|
|
then
|
2011-02-22 10:39:50 +00:00
|
|
|
return 1
|
2011-02-21 18:48:39 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Completed file: $TESTFILE" >&2
|
|
|
|
fi
|
2022-01-26 22:16:04 +00:00
|
|
|
else
|
|
|
|
echo "Skipped (not built) file: $TESTFILE" >&2
|
2011-02-21 18:48:39 +00:00
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
|
|
|
|
run_test_log ()
|
2011-02-07 20:41:58 +00:00
|
|
|
{
|
2022-01-26 22:16:04 +00:00
|
|
|
local TESTFILE=$1
|
|
|
|
local TESTNAME=$2
|
|
|
|
local TESTLOG=$3
|
|
|
|
local TESTVRB=$4
|
2011-03-01 09:30:29 +00:00
|
|
|
|
2022-01-27 17:06:50 +00:00
|
|
|
# Create temporary files
|
2022-01-31 15:35:46 +00:00
|
|
|
touch $TESTVRB
|
2022-01-27 17:06:50 +00:00
|
|
|
echo Testing $TESTFILE... > $TESTLOG
|
2011-03-01 09:30:29 +00:00
|
|
|
|
|
|
|
if test x"$GSVERBOSE" = xyes
|
2011-02-16 05:44:45 +00:00
|
|
|
then
|
2022-01-31 15:35:46 +00:00
|
|
|
run_test $TESTFILE $TESTNAME 2>&1 | tee -a $TESTLOG >> $TESTVRB
|
2011-02-20 14:59:52 +00:00
|
|
|
else
|
2022-01-26 22:16:04 +00:00
|
|
|
run_test $TESTFILE $TESTNAME >> $TESTLOG 2>&1
|
2011-03-01 09:30:29 +00:00
|
|
|
fi
|
2022-02-16 09:28:34 +00:00
|
|
|
result=$?
|
|
|
|
if test "$result" != "0"
|
|
|
|
then
|
|
|
|
if test "$GSTESTMODE" = "failfast"
|
|
|
|
then
|
|
|
|
RUNEXIT=1
|
|
|
|
fi
|
|
|
|
fi
|
2022-01-26 22:16:04 +00:00
|
|
|
}
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
proc_test_log ()
|
|
|
|
{
|
|
|
|
local TESTFILE=$1
|
|
|
|
local TESTNAME=$2
|
|
|
|
local TESTLOG=$3
|
|
|
|
local TESTVRB=$4
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2011-03-01 09:30:29 +00:00
|
|
|
# Extract the summary information and add it to the summary file.
|
2022-01-26 22:16:04 +00:00
|
|
|
extract $TESTLOG "^Passed test:" "^Failed test:" "^Failed build:" "^Completed file:" "^Failed file:" "^Dashed hope:" "^Failed set:" "^Skipped set:" > $GSTESTSUM.tmp
|
2011-03-01 09:30:29 +00:00
|
|
|
cat $GSTESTSUM.tmp >> $GSTESTSUM
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
cat $TESTLOG >> $GSTESTLOG
|
2022-01-31 13:35:40 +00:00
|
|
|
rm -f $TESTLOG
|
|
|
|
cat $TESTVRB
|
|
|
|
rm -f $TESTVRB
|
2022-01-26 22:16:04 +00:00
|
|
|
|
2011-03-01 09:30:29 +00:00
|
|
|
# If there were failures or skipped tests then report them...
|
|
|
|
if present $GSTESTSUM.tmp "^Failed build:" "^Failed file:" "^Failed set:" "^Failed test:" "^Skipped set:"
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo $dir/$TESTFILE:
|
|
|
|
extract $GSTESTSUM.tmp "^Failed build:" "^Failed file:" "^Failed set:" "^Failed test:" "^Skipped set:"
|
2022-02-16 09:28:34 +00:00
|
|
|
if test "$GSTESTMODE" = "failfast"
|
|
|
|
then
|
|
|
|
RUNEXIT=1
|
|
|
|
fi
|
2022-01-26 22:16:04 +00:00
|
|
|
else
|
|
|
|
RUNEXIT=0
|
2011-03-01 09:30:29 +00:00
|
|
|
fi
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2011-03-01 09:30:29 +00:00
|
|
|
if test x"$GSTESTDBG" != x
|
|
|
|
then
|
2022-08-02 14:26:35 +00:00
|
|
|
DEBUGGER=`gnustep-config --variable=DEBUGGER`
|
|
|
|
EXT=`gnustep-config --variable=EXEEXT`
|
2011-03-01 09:30:29 +00:00
|
|
|
if present "$GSTESTSUM.tmp" "^Failed test:"
|
2011-02-18 16:10:47 +00:00
|
|
|
then
|
2022-12-05 10:58:38 +00:00
|
|
|
grep -a '^Failed test:' "$GSTESTLOG.tmp" | sed -e 's/^Failed test:[^:]*:\([0-9][0-9]*\).*/break testStart if testLineNumber==\1/' > "$GSTESTDBG"
|
2022-08-02 16:35:28 +00:00
|
|
|
$DEBUGGER "./obj/$TESTNAME"$EXT -x "$GSTESTDBG"
|
2011-03-01 09:30:29 +00:00
|
|
|
rm -f "$GSTESTDBG"
|
|
|
|
elif present "$GSTESTSUM.tmp" "^Failed file:"
|
2011-02-22 09:16:18 +00:00
|
|
|
then
|
2022-08-02 16:35:28 +00:00
|
|
|
$DEBUGGER "./obj/$TESTNAME"$EXT
|
2011-02-22 09:16:18 +00:00
|
|
|
fi
|
2011-02-07 20:41:58 +00:00
|
|
|
fi
|
2011-03-01 09:30:29 +00:00
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
return 0
|
2011-02-07 20:41:58 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 08:05:06 +00:00
|
|
|
# Replace the old files.
|
2011-02-19 05:21:40 +00:00
|
|
|
if test -f tests.log
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
|
|
|
mv tests.log oldtests.log
|
|
|
|
fi
|
2011-02-19 05:21:40 +00:00
|
|
|
if test -f tests.sum
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
|
|
|
mv tests.sum oldtests.sum
|
|
|
|
fi
|
|
|
|
|
2011-02-16 09:46:28 +00:00
|
|
|
SUMD=.
|
2011-03-01 09:30:29 +00:00
|
|
|
foundany=no
|
2011-02-20 09:34:47 +00:00
|
|
|
for TESTDIR in $TESTDIRS
|
|
|
|
do
|
|
|
|
found=no
|
2011-03-18 20:09:47 +00:00
|
|
|
source=no
|
2011-02-28 12:17:47 +00:00
|
|
|
if test x"$TESTS" = x
|
|
|
|
then
|
|
|
|
# Get the names of all subdirectories containing source files.
|
2011-03-29 13:51:14 +00:00
|
|
|
if test x"$OBJCXX" = x
|
2011-03-21 08:48:20 +00:00
|
|
|
then
|
|
|
|
# Only Objective-C (and C)
|
2013-06-17 06:20:47 +00:00
|
|
|
SRCDIRS=`find $TESTDIR -name "*.m" -o -name "*.c" | sed -e 's;/[^/]*$;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
2011-03-21 08:48:20 +00:00
|
|
|
else
|
|
|
|
# Objective-C and Objective-C++ (implicitly C and C++ too)
|
2013-06-17 06:20:47 +00:00
|
|
|
SRCDIRS=`find $TESTDIR \( -name "*.m" -o -name "*.mm" -o -name "*.c" -o -name "*.cc" \) | sed -e 's;/[^/]*$;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
2011-03-21 08:48:20 +00:00
|
|
|
fi
|
2011-02-28 12:17:47 +00:00
|
|
|
else
|
|
|
|
SRCDIRS="$TESTDIRS"
|
|
|
|
fi
|
2011-02-20 09:34:47 +00:00
|
|
|
if test x"$SRCDIRS" = x
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
fi
|
2011-03-14 08:39:07 +00:00
|
|
|
|
2011-03-18 20:09:47 +00:00
|
|
|
# found some source code
|
|
|
|
source=yes
|
2011-02-20 09:34:47 +00:00
|
|
|
SUMD=$TESTDIR
|
|
|
|
for dir in $SRCDIRS
|
2011-02-07 20:41:58 +00:00
|
|
|
do
|
2011-02-23 18:49:29 +00:00
|
|
|
if test ! -f $dir/TestInfo
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
2011-02-19 16:46:10 +00:00
|
|
|
continue
|
|
|
|
fi
|
2011-03-01 09:30:29 +00:00
|
|
|
|
2011-03-14 08:39:07 +00:00
|
|
|
# Step up through parents of the source directory to find the root of the
|
|
|
|
# test suite (the highest level directory containing a TestInfo file.
|
|
|
|
# Provide that in the environment for use within the makefiles/scripts.
|
|
|
|
GSTESTROOT=$dir
|
|
|
|
parentdir=`dirname $GSTESTROOT`
|
|
|
|
while test -f "$parentdir/TestInfo"
|
|
|
|
do
|
|
|
|
GSTESTROOT="$parentdir"
|
|
|
|
parentdir=`dirname $GSTESTROOT`
|
|
|
|
if test $parentdir = $GSTESTROOT
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
export GSTESTROOT
|
|
|
|
|
2011-03-01 09:30:29 +00:00
|
|
|
RUNEXIT=0
|
2011-02-20 09:34:47 +00:00
|
|
|
found=yes
|
2011-03-01 09:30:29 +00:00
|
|
|
foundany=yes
|
|
|
|
|
2011-02-20 09:34:47 +00:00
|
|
|
cd $dir
|
2011-02-19 16:46:10 +00:00
|
|
|
|
2011-02-20 09:34:47 +00:00
|
|
|
if test "$GSTESTMODE" = "clean"
|
|
|
|
then
|
|
|
|
echo "--- Cleaning tests in $dir ---"
|
2011-03-01 09:30:29 +00:00
|
|
|
|
|
|
|
if test -r GNUmakefile
|
|
|
|
then
|
|
|
|
$MAKE_CMD clean >/dev/null 2>&1
|
|
|
|
fi
|
2022-01-27 10:48:51 +00:00
|
|
|
rm -rf core core.* *.core obj GNUmakefile gdb.cmds test_*.err test_*.out tests.log tests.sum oldtests.log oldtests.sum tests.tmp tests.sum.tmp tests.log.tmp make-check.mak make-check.env
|
2011-03-01 09:30:29 +00:00
|
|
|
|
2011-02-20 09:34:47 +00:00
|
|
|
else
|
|
|
|
echo "--- Running tests in $dir ---"
|
2011-03-01 09:30:29 +00:00
|
|
|
|
2011-02-20 09:34:47 +00:00
|
|
|
if test -r ./Start.sh -a -x ./Start.sh
|
2011-02-13 08:05:06 +00:00
|
|
|
then
|
2011-02-20 09:34:47 +00:00
|
|
|
./Start.sh
|
2015-01-15 12:27:58 +00:00
|
|
|
STARTSCRIPTSTATUS=$?
|
|
|
|
else
|
|
|
|
STARTSCRIPTSTATUS=0
|
2011-02-19 16:46:10 +00:00
|
|
|
fi
|
2011-02-25 17:42:21 +00:00
|
|
|
|
2015-01-19 12:32:19 +00:00
|
|
|
# Get the names of all the source files in the current directory.
|
|
|
|
if test x"$TESTS" = x
|
2011-02-25 17:42:21 +00:00
|
|
|
then
|
2015-01-19 12:32:19 +00:00
|
|
|
if test x"$OBJCXX" = x
|
2011-03-21 08:48:20 +00:00
|
|
|
then
|
2015-01-19 12:32:19 +00:00
|
|
|
# Only Objective-C (and C)
|
|
|
|
TESTS=`find . \( -name . -o -prune \) \( -name "*.m" -o -name "*.c" \) | sed -e 's;^.*/;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
|
|
|
else
|
|
|
|
# Objective-C and Objective-C++ (implicitly C and C++ too)
|
|
|
|
TESTS=`find . \( -name . -o -prune \) \( -name "*.m" -o -name "*.mm" -name "*.c" -o -name "*.cc" \) | sed -e 's;^.*/;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
|
2015-01-15 12:27:58 +00:00
|
|
|
fi
|
2015-01-19 12:32:19 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test $STARTSCRIPTSTATUS = 0
|
|
|
|
then
|
2011-02-25 17:42:21 +00:00
|
|
|
|
2015-01-15 12:27:58 +00:00
|
|
|
if test -r GNUmakefile.tests
|
|
|
|
then
|
|
|
|
# There's a custom make template present ... use it.
|
|
|
|
TEMPLATE=GNUmakefile.tests
|
2015-10-25 09:17:24 +00:00
|
|
|
elif test -r make-check.mak
|
|
|
|
then
|
|
|
|
# There's an autogenerated makefile present ... use default template.
|
|
|
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
2015-01-15 12:27:58 +00:00
|
|
|
elif test -r GNUmakefile.preamble
|
|
|
|
then
|
|
|
|
# There's a make preamble present ... use default template.
|
|
|
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
|
|
|
elif test -r GNUmakefile.postamble
|
|
|
|
then
|
|
|
|
# There's a make postamble present ... use default template.
|
|
|
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
|
|
|
elif test -r ../GNUmakefile.super
|
|
|
|
then
|
|
|
|
# There's a make superfile present ... use default template.
|
|
|
|
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
|
|
|
elif test -r "$TESTS"
|
|
|
|
then
|
|
|
|
# Single readable file ... quicker to compile directly.
|
|
|
|
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
|
2011-02-21 18:48:39 +00:00
|
|
|
|
2015-01-15 12:27:58 +00:00
|
|
|
if test x"$TEMPLATE" = x
|
|
|
|
then
|
2016-05-13 09:53:44 +00:00
|
|
|
rm -rf core core.* *.core obj GNUmakefile gdb.cmds
|
2015-01-15 12:27:58 +00:00
|
|
|
else
|
|
|
|
TESTNAMES=
|
|
|
|
TESTRULES=
|
|
|
|
for TESTFILE in $TESTS
|
|
|
|
do
|
|
|
|
tmp=`basename $TESTFILE .m`
|
2013-06-17 06:20:47 +00:00
|
|
|
if test x"$tmp" = x"$TESTFILE"
|
|
|
|
then
|
2015-01-15 12:27:58 +00:00
|
|
|
tmp=`basename $TESTFILE .mm`
|
2013-06-17 06:20:47 +00:00
|
|
|
if test x"$tmp" = x"$TESTFILE"
|
|
|
|
then
|
2015-01-15 12:27:58 +00:00
|
|
|
tmp=`basename $TESTFILE .c`
|
|
|
|
if test x"$tmp" = x"$TESTFILE"
|
|
|
|
then
|
|
|
|
TESTRULES="$TESTRULES\\
|
2013-06-17 06:20:47 +00:00
|
|
|
${tmp}_CC_FILES=$TESTFILE"
|
2015-01-15 12:27:58 +00:00
|
|
|
else
|
|
|
|
TESTRULES="$TESTRULES\\
|
|
|
|
${tmp}_C_FILES=$TESTFILE"
|
|
|
|
fi
|
2013-06-17 06:20:47 +00:00
|
|
|
else
|
|
|
|
TESTRULES="$TESTRULES\\
|
2015-01-15 12:27:58 +00:00
|
|
|
${tmp}_OBJCC_FILES=$TESTFILE"
|
2013-06-17 06:20:47 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
TESTRULES="$TESTRULES\\
|
2011-03-01 09:30:29 +00:00
|
|
|
${tmp}_OBJC_FILES=$TESTFILE"
|
2015-01-15 12:27:58 +00:00
|
|
|
fi
|
|
|
|
TESTNAMES="$TESTNAMES $tmp"
|
|
|
|
done
|
|
|
|
sed -e "s/@TESTNAMES@/$TESTNAMES/;s^@TESTOPTS@^$GSTESTOPTS^;s/@TESTRULES@/$TESTRULES/" < "$TEMPLATE" > GNUmakefile
|
|
|
|
$MAKE_CMD clean >/dev/null 2>&1
|
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
if test x"$GSSEQUENTIAL" = xyes
|
2015-10-25 09:17:24 +00:00
|
|
|
then
|
2022-01-26 22:16:04 +00:00
|
|
|
build_state=1
|
2015-10-25 09:17:24 +00:00
|
|
|
else
|
2022-01-26 22:16:04 +00:00
|
|
|
# Try building all the test files in the directory in parallel.
|
|
|
|
# If that fails, try building them individually.
|
|
|
|
echo "" >>$GSTESTLOG
|
|
|
|
echo "Building in $dir" >>$GSTESTLOG
|
|
|
|
if test -r ./make-check.env
|
|
|
|
then
|
2023-01-09 22:30:22 +00:00
|
|
|
( . ./make-check.env; . ./TestInfo > /dev/null 2>&1; $MAKE_CMD -j 4 $GSMAKEOPTIONS) >>$GSTESTLOG 2>&1
|
2022-01-26 22:16:04 +00:00
|
|
|
else
|
2023-01-09 22:30:22 +00:00
|
|
|
( . ./TestInfo > /dev/null 2>&1; $MAKE_CMD -j 4 $GSMAKEOPTIONS) >>$GSTESTLOG 2>&1
|
2022-01-26 22:16:04 +00:00
|
|
|
fi
|
|
|
|
build_state=$?
|
2015-10-25 09:17:24 +00:00
|
|
|
fi
|
2022-01-26 22:16:04 +00:00
|
|
|
if test $build_state != 0
|
2015-01-15 12:27:58 +00:00
|
|
|
then
|
2022-01-26 22:16:04 +00:00
|
|
|
for TESTFILE in $TESTS
|
|
|
|
do
|
|
|
|
build_test "$TESTFILE"
|
|
|
|
done
|
2015-01-15 12:27:58 +00:00
|
|
|
fi
|
|
|
|
fi
|
2011-02-20 09:34:47 +00:00
|
|
|
|
2022-01-26 22:16:04 +00:00
|
|
|
# Build up a list of the names of all the tests available.
|
|
|
|
declare -A TESTMAP
|
|
|
|
ALLTESTS=""
|
2015-01-15 12:27:58 +00:00
|
|
|
for TESTFILE in $TESTS
|
|
|
|
do
|
2022-01-26 22:16:04 +00:00
|
|
|
getname $TESTFILE
|
|
|
|
TESTMAP["$TESTNAME"]="$TESTFILE"
|
|
|
|
if test "$ALLTESTS" = ""
|
|
|
|
then
|
|
|
|
ALLTESTS="$TESTNAME"
|
|
|
|
else
|
|
|
|
ALLTESTS="$ALLTESTS $TESTNAME"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Get the values defined for PARALLEL and PARALLEL in TestInfo
|
|
|
|
# These variables should specify the names of sets of tests to
|
|
|
|
# be executed in parallel or sequentially respectively.
|
2022-03-01 13:57:56 +00:00
|
|
|
GSPAR=`( . ./TestInfo > /dev/null 2>&1; echo "$PARALLEL") 2>&1`
|
|
|
|
GSSEQ=`( . ./TestInfo > /dev/null 2>&1; echo "$SEQUENCE") 2>&1`
|
2022-01-26 22:16:04 +00:00
|
|
|
|
|
|
|
# When PARALLEL and SEQUENCE are both missing or empty, we treat
|
|
|
|
# it as if SEQUENCE had been set to contain an asterisk so that
|
|
|
|
# all the tests are executed in order.
|
|
|
|
if test "$GSPAR" = "" -a "$GSSEQ" = ""
|
|
|
|
then
|
|
|
|
GSSEQ="*"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Any occurrence of an asterisk in PARALLEL or SEQUENCE is replaced
|
|
|
|
# by the names of all the tests separated by white space.
|
|
|
|
GSPAR=`echo "$GSPAR" | sed -e "s/\*/ $ALLTESTS /g"`
|
|
|
|
GSSEQ=`echo "$GSSEQ" | sed -e "s/\*/ $ALLTESTS /g"`
|
|
|
|
|
|
|
|
# NB. we check the map to see that a file exists for each test name
|
|
|
|
# because the names we have been given may not exist in the set of
|
|
|
|
# tests being run (ie specified at the cvommand line).
|
|
|
|
|
|
|
|
# Now we process sequence test file in turn.
|
2022-01-27 10:48:51 +00:00
|
|
|
i=0
|
2022-01-26 22:16:04 +00:00
|
|
|
for TESTNAME in $GSSEQ
|
|
|
|
do
|
|
|
|
TESTFILE=${TESTMAP[$TESTNAME]}
|
|
|
|
if test "$TESTFILE" != ""
|
|
|
|
then
|
|
|
|
if test x"$GSVERBOSE" = xyes
|
|
|
|
then
|
|
|
|
echo "Sequence perform $TESTNAME"
|
|
|
|
fi
|
2022-01-27 10:48:51 +00:00
|
|
|
run_test_log $TESTFILE $TESTNAME test_$i.out test_$i.err
|
|
|
|
proc_test_log $TESTFILE $TESTNAME test_$i.out test_$i.err
|
2022-01-26 22:16:04 +00:00
|
|
|
if test "$RUNEXIT" != "0"
|
|
|
|
then
|
2022-02-16 09:28:34 +00:00
|
|
|
break
|
2022-01-26 22:16:04 +00:00
|
|
|
fi
|
2022-01-27 10:48:51 +00:00
|
|
|
((i+=1))
|
2022-01-26 22:16:04 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# And process all parallel test files together
|
|
|
|
i=0
|
|
|
|
for TESTNAME in $GSPAR
|
|
|
|
do
|
|
|
|
TESTFILE=${TESTMAP[$TESTNAME]}
|
|
|
|
if test "$TESTFILE" != ""
|
|
|
|
then
|
|
|
|
if test x"$GSVERBOSE" = xyes
|
|
|
|
then
|
2022-01-31 15:35:46 +00:00
|
|
|
echo "Parallel startup $TESTNAME"
|
2022-01-26 22:16:04 +00:00
|
|
|
fi
|
|
|
|
run_test_log $TESTFILE $TESTNAME test_$i.out test_$i.err &
|
|
|
|
((i+=1))
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
i=0
|
|
|
|
for TESTNAME in $GSPAR
|
|
|
|
do
|
|
|
|
TESTFILE=${TESTMAP[$TESTNAME]}
|
|
|
|
if test "$TESTFILE" != ""
|
2015-01-15 12:27:58 +00:00
|
|
|
then
|
2022-01-26 22:16:04 +00:00
|
|
|
proc_test_log $TESTFILE $TESTNAME test_$i.out test_$i.err
|
|
|
|
if test "$RUNEXIT" != "0"
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
((i+=1))
|
2015-01-15 12:27:58 +00:00
|
|
|
fi
|
|
|
|
done
|
2022-01-26 22:16:04 +00:00
|
|
|
|
2015-01-15 12:27:58 +00:00
|
|
|
else
|
|
|
|
echo "Start.sh failed in '$TESTDIR' ... tests abandoned."
|
2015-01-19 12:32:19 +00:00
|
|
|
for TESTFILE in $TESTS
|
|
|
|
do
|
|
|
|
echo "Failed file: $TESTFILE aborted without running any tests!" | tee -a $GSTESTSUM >> $GSTESTLOG
|
|
|
|
done
|
2015-01-15 12:27:58 +00:00
|
|
|
fi
|
2011-03-01 09:30:29 +00:00
|
|
|
TESTS=
|
|
|
|
|
2011-02-25 17:42:21 +00:00
|
|
|
# And perform the directory end script.
|
2011-02-20 09:34:47 +00:00
|
|
|
if test -r ./End.sh -a -x ./End.sh
|
|
|
|
then
|
|
|
|
./End.sh
|
|
|
|
fi
|
2011-02-19 16:46:10 +00:00
|
|
|
fi
|
2011-02-20 09:34:47 +00:00
|
|
|
|
|
|
|
cd $GSTESTDIR
|
2011-02-19 16:46:10 +00:00
|
|
|
if test "$RUNEXIT" != "0"
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
2011-02-07 20:41:58 +00:00
|
|
|
done
|
2011-03-01 09:30:29 +00:00
|
|
|
|
|
|
|
# Log a message if there were no tests in this directory,
|
|
|
|
# but only if the directory was specifically named to be tested.
|
2011-02-20 09:34:47 +00:00
|
|
|
if test $found = no
|
|
|
|
then
|
2011-03-01 09:30:29 +00:00
|
|
|
if test "$NONAME" = "no"
|
|
|
|
then
|
2011-03-18 20:09:47 +00:00
|
|
|
if test $source = no
|
|
|
|
then
|
|
|
|
echo "No tests found in '$TESTDIR'."
|
|
|
|
else
|
|
|
|
echo "No directories with 'TestInfo' marker file in '$TESTDIR'."
|
|
|
|
fi
|
2011-03-01 09:30:29 +00:00
|
|
|
fi
|
2011-02-20 09:34:47 +00:00
|
|
|
fi
|
2011-03-01 09:30:29 +00:00
|
|
|
|
2011-02-20 09:34:47 +00:00
|
|
|
if test "$RUNEXIT" != "0"
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2011-03-01 09:30:29 +00:00
|
|
|
# Log a message if there were no tests found at all and we had been
|
|
|
|
# looking in the current directory for test subdirectories.
|
|
|
|
if test $foundany = no
|
|
|
|
then
|
|
|
|
if test "$NONAME" = "yes"
|
|
|
|
then
|
|
|
|
echo "No test subdirectories found."
|
|
|
|
else
|
2011-03-18 20:09:47 +00:00
|
|
|
echo "No tests found in '$TESTDIRS'."
|
2011-03-01 09:30:29 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-02-19 05:21:40 +00:00
|
|
|
if test "$GSTESTMODE" = "clean"
|
2011-02-07 20:41:58 +00:00
|
|
|
then
|
2022-01-27 10:48:51 +00:00
|
|
|
rm -rf core core.* *.core obj GNUmakefile.tmp gdb.cmds test_*.err test_*.out tests.tmp tests.sum.tmp tests.log.tmp tests.log tests.sum oldtests.log oldtests.sum
|
2011-02-07 20:41:58 +00:00
|
|
|
else
|
2011-02-13 08:05:06 +00:00
|
|
|
# Make some stats.
|
2011-02-19 05:21:40 +00:00
|
|
|
if test -r tests.sum
|
2011-02-13 08:05:06 +00:00
|
|
|
then
|
2011-02-13 12:40:12 +00:00
|
|
|
# Nasty pipeline of commands ...
|
|
|
|
# Look for each type of test result, sort and count the results,
|
|
|
|
# append 's' to each summary, then remove the trailing 's' from
|
|
|
|
# any summary with only a single result so the output is pretty.
|
2011-02-13 13:02:20 +00:00
|
|
|
# Sort the resulting lines by number of each status with the most
|
|
|
|
# common (hopefully passes) output first.
|
2011-02-16 05:44:45 +00:00
|
|
|
# NB. we omit the 'Completed file' tests as uninteresting ... users
|
|
|
|
# generally only want to see the total pass count and any problems.
|
2011-02-21 18:48:39 +00:00
|
|
|
extract tests.sum "^Passed test:" "^Failed test:" "^Failed build:" "^Failed file:" "^Dashed hope:" "^Failed set:" "^Skipped set:" | cut -d: -f1 | sort | uniq -c | sed -e 's/.*/&s/' | sed -e 's/^\([^0-9]*1[^0-9].*\)s$/\1/' | sort -n -b -r > tests.tmp
|
2011-02-13 08:05:06 +00:00
|
|
|
else
|
|
|
|
echo "No tests found." > tests.tmp
|
|
|
|
fi
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2011-02-13 08:05:06 +00:00
|
|
|
echo >> tests.sum
|
|
|
|
cat tests.tmp >> tests.sum
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2011-02-13 08:05:06 +00:00
|
|
|
echo
|
|
|
|
cat tests.tmp
|
2011-02-16 05:44:45 +00:00
|
|
|
echo
|
|
|
|
|
2011-02-16 09:46:28 +00:00
|
|
|
fi
|
2011-02-16 05:44:45 +00:00
|
|
|
|
2011-02-16 09:46:28 +00:00
|
|
|
# In the case where we ran a single testsuite, we allow the Summary.sh
|
|
|
|
# script in that testsuite to generate our summary.
|
2011-02-19 05:21:40 +00:00
|
|
|
if test x"$TESTDIRS" = x"$SUMD" -a -r $SUMD/Summary.sh -a -x $SUMD/Summary.sh
|
2011-02-16 09:46:28 +00:00
|
|
|
then
|
|
|
|
RUNCMD=$SUMD/Summary.sh
|
|
|
|
else
|
2011-02-21 09:26:43 +00:00
|
|
|
RUNCMD=$GSTESTTOP/Summary.sh
|
2011-02-13 08:05:06 +00:00
|
|
|
fi
|
2011-02-16 09:46:28 +00:00
|
|
|
$RUNCMD
|
2015-10-26 10:20:06 +00:00
|
|
|
FAILS=$?
|
2011-02-07 20:41:58 +00:00
|
|
|
|
|
|
|
# Delete the temporary file.
|
2022-01-27 10:48:51 +00:00
|
|
|
rm -f test_*.err test_*.out tests.tmp tests.sum.tmp tests.log.tmp
|
2011-02-07 20:41:58 +00:00
|
|
|
|
2015-10-26 10:20:06 +00:00
|
|
|
# Our exit status is 0 unless some test failed.
|
2016-05-14 09:13:47 +00:00
|
|
|
if test -r "$GSTESTSUM"
|
2015-10-26 10:20:06 +00:00
|
|
|
then
|
2016-05-14 09:13:47 +00:00
|
|
|
present "$GSTESTSUM" "Failed set$" "Failed sets$" "Failed test$" "Failed tests$" "Failed build$" "Failed builds$" "Failed file$" "Failed files$"
|
|
|
|
if [ $? = 1 ]
|
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-10-26 10:20:06 +00:00
|
|
|
else
|
2016-05-14 09:13:47 +00:00
|
|
|
exit 0
|
2015-10-26 10:20:06 +00:00
|
|
|
fi
|