hypre/AUTOTEST/examples.sh

96 lines
2.0 KiB
Bash
Raw Normal View History

2007-12-01 06:46:12 +08:00
#!/bin/sh
2019-07-08 10:26:24 +08:00
# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
2007-12-01 06:46:12 +08:00
#
2019-07-08 10:26:24 +08:00
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
2007-12-01 06:46:12 +08:00
testname=`basename $0 .sh`
tests=""
2007-12-01 06:46:12 +08:00
# Echo usage information
case $1 in
-h|-help)
cat <<EOF
2007-12-01 06:46:12 +08:00
$0 [-h] {src_dir} [options] [-rt <options for runtest.sh script>]
2007-12-01 06:46:12 +08:00
2020-05-16 23:30:29 +08:00
where: {src_dir} is the hypre source directory
-<test> run <test> (test = default, bigint, maxdim, complex)
-spack <dir> compile and link drivers to spack build
-h|-help prints this usage information and exits
2007-12-01 06:46:12 +08:00
This script builds the hypre example codes in {src_dir}/examples and runs the
example regression tests in test/TEST_examples.
2007-12-01 06:46:12 +08:00
Example usage: $0 ../src -maxdim
2007-12-01 06:46:12 +08:00
EOF
exit
;;
esac
# Set src_dir
src_dir=`cd $1; pwd`
shift
# Parse the rest of the command line
while [ "$*" ]
do
case $1 in
-rt)
shift
break
;;
2020-05-16 23:30:29 +08:00
-spack)
shift; spackdir="$1"; shift
;;
-*)
tname=`echo $1 | sed 's/-//'`
tests="$tests $tname"
shift
;;
esac
done
# If no tests were specified, run default
if [ "$tests" = "" ]; then
tests="default"
fi
2007-12-01 06:46:12 +08:00
# Setup
output_dir=`pwd`/$testname.dir
rm -fr $output_dir
mkdir -p $output_dir
2007-12-01 06:46:12 +08:00
# Run make in the examples directory
cd $src_dir/examples
2007-12-01 06:46:12 +08:00
make clean
2020-05-16 23:30:29 +08:00
mopt=""
if [ -n "$spackdir" ]; then
mopt="HYPRE_DIR=$spackdir"
fi
for tname in $tests
do
2020-05-16 23:30:29 +08:00
make $mopt $tname
done
# Run the examples regression test
cd $src_dir/test
for tname in $tests
do
./runtest.sh $@ TEST_examples/$tname.sh
done
# Collect all error files from the tests
for errfile in $( find TEST_examples -name "*.err" -o -name "*.fil" -o -name "*.out*" )
do
mkdir -p $output_dir/`dirname $errfile`
mv -f $errfile $output_dir/$errfile
done
# Echo to stderr all nonempty error files in $output_dir
for errfile in $( find $output_dir ! -size 0 -name "*.err" )
do
echo $errfile >&2
done