#!/bin/sh
# test-driver-ff from test-driver - basic testsuite driver script.
# modif F. Hecht UPMC.
scriptversion=2025-02-21.16; # UTC
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
#
# This program 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 2, or (at your option)
# any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to or send patches to
# .
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <$log_file 2>&1
estatus=77
else
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
FFnp=`awk '$1=="//" && $2=="NBPROC" { if( vv == ""){ print $3;}; vv=1}' "$@"`
FLAGS_FFPP_A=`awk '$1=="//" && $2=="PARAM" { if( vv == ""){ for(i=3;i<=NF;++i)print $i;}; vv=1}' "$@"`
if [ "0$FFnp" -gt 0 ] ; then
FLAGS_FFPP_B="-np $FFnp -nw"
else
FLAGS_FFPP_B="${FLAGS_FFPP}"
fi
export MPIEXEC_TIMEOUT=50
test -z "${COMMONPROGRAMFILES+x}" -a -z "${WINDIR+x}" && ulimit -t 60
${TEST_FFPP} ${FLAGS_FFPP_B} "$@" ${FLAGS_FFPP_A}>$log_file 2>&1
estatus=$?
echo "status " $estatus >>$log_file
FAIL_CPU_LIMIT=`tail -100 $log_file|egrep -i 'Cputime limit exceeded|MPIEXEC_TIMEOUT|APPLICATION TIMED OUT|Timeout after'|wc -l`
fi
# Catch ulimit timeout on Linux
if [ $estatus -eq 137 ]; then
FAIL_CPU_LIMIT=2
fi
## Add an error suffix in order to extract errored tests only
if [ $estatus -ne 0 ] && [ $estatus -ne 77 ]; then
cp $log_file "${log_file}.err"
fi
if test $enable_hard_errors = no && test $estatus -eq 99; then
estatus=1
fi
if test "${FAIL_CPU_LIMIT:-0}" -ge 1 ; then
expect_failure=cpu;
fi
case $estatus:$expect_failure in
0:yes) col=$grn res=PASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:cpu) col=$ora res=CPU recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: