1# Common functionality for test scripts 2# Process arguments, expecting source file as 1st; optional path to f18 as 2nd 3# Set: $F18 to the path to f18; $temp to an empty temp directory; $src 4# to the full path of the single source argument; and $USER_OPTIONS to the 5# option list given in the $src file after string "OPTIONS:" 6 7function die { 8 echo "$(basename $0): $*" >&2 9 exit 1 10} 11if [[ $# < 3 ]]; then 12 echo "Usage: $(basename $0) <fortran-source> <f18-executable> <temp test dir>" 13 exit 1 14fi 15 16case $1 in 17 (/*) src=$1 ;; 18 (*) src=$(dirname $0)/$1 ;; 19esac 20USER_OPTIONS=`sed -n 's/^ *! *OPTIONS: *//p' $src` 21echo $USER_OPTIONS 22F18=$2 23[[ ! -f $F18 ]] && die "f18 executable not found: $F18" 24temp=$3 25mkdir -p $temp 26