2007-11-17 04:54:15 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
#BHEADER**********************************************************************
|
2007-11-22 08:44:34 +08:00
|
|
|
# Copyright (c) 2007, Lawrence Livermore National Security, LLC.
|
2007-11-17 04:54:15 +08:00
|
|
|
# Produced at the Lawrence Livermore National Laboratory.
|
|
|
|
|
# Written by the HYPRE team. UCRL-CODE-222953.
|
|
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
# This file is part of HYPRE (see http://www.llnl.gov/CASC/hypre/).
|
|
|
|
|
# Please see the COPYRIGHT_and_LICENSE file for the copyright notice,
|
|
|
|
|
# disclaimer, contact information and the GNU Lesser General Public License.
|
|
|
|
|
#
|
|
|
|
|
# HYPRE 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) version 2.1 dated February 1999.
|
|
|
|
|
#
|
|
|
|
|
# HYPRE 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 terms and conditions of the GNU General
|
|
|
|
|
# Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
#
|
|
|
|
|
# $Revision$
|
|
|
|
|
#EHEADER**********************************************************************
|
|
|
|
|
|
|
|
|
|
while [ "$*" ]
|
|
|
|
|
do
|
|
|
|
|
case $1 in
|
|
|
|
|
-h|-help)
|
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
|
|
$0 [options] {testname}.sh [{testname}.sh args]
|
|
|
|
|
|
|
|
|
|
where: {testname} is the user-defined name for the test script
|
|
|
|
|
|
|
|
|
|
with options:
|
|
|
|
|
-h|-help prints this usage information and exits
|
|
|
|
|
-t|-trace echo each command
|
|
|
|
|
|
2007-11-30 07:40:58 +08:00
|
|
|
This script runs the Bourne shell test '{testname}.sh' and creates output
|
|
|
|
|
files named '{testname}.err' and '{testname}.out' which capture the stderr
|
|
|
|
|
and stdout output from the test. The test script is run from the current
|
|
|
|
|
directory, which should contain this script, '{test_name}.sh', and any other
|
|
|
|
|
supporting files.
|
2007-11-17 04:54:15 +08:00
|
|
|
|
2007-11-30 07:40:58 +08:00
|
|
|
A test is deemed to have passed when nothing is written to stderr. A test
|
|
|
|
|
may call other tests. A test may take arguments, such as directories or
|
|
|
|
|
files. A test may also create output, which should be collected by the test
|
|
|
|
|
in a directory named '{testname}.dir'. A test may also require additional
|
|
|
|
|
"filtering" in situations where information is erroneously written to stderr.
|
|
|
|
|
Text identifying lines to be filtered are added to '{testname}.filters'.
|
|
|
|
|
Usage documentation should appear at the top of each test.
|
2007-11-17 04:54:15 +08:00
|
|
|
|
|
|
|
|
Example usage: $0 default.sh ..
|
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
exit
|
|
|
|
|
;;
|
|
|
|
|
-t|-trace)
|
|
|
|
|
set -xv
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
break
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2007-11-29 06:31:38 +08:00
|
|
|
# Run the test and capture stdout, stderr
|
2007-11-17 04:54:15 +08:00
|
|
|
testname=`basename $1 .sh`
|
|
|
|
|
shift
|
|
|
|
|
echo "Running test [$testname]"
|
2007-11-27 03:26:00 +08:00
|
|
|
./$testname.sh $@ 1>"$testname.out" 2>"$testname.err"
|
2007-11-29 06:31:38 +08:00
|
|
|
|
|
|
|
|
# Filter misleading error messages
|
|
|
|
|
if [ -e $testname.filters ]; then
|
|
|
|
|
if (egrep -f $testname.filters $testname.err > /dev/null) ; then
|
|
|
|
|
echo "This file contains the original copy of $testname.err before filtering" > $testname.fil
|
|
|
|
|
cat $testname.err >> $testname.fil
|
|
|
|
|
mv $testname.err $testname.tmp
|
|
|
|
|
egrep -v -f $testname.filters $testname.tmp > $testname.err
|
|
|
|
|
rm -f $testname.tmp
|
|
|
|
|
fi
|
|
|
|
|
fi
|