27 lines · bash
1# Common functionality for test scripts2# Process arguments, expecting source file as 1st; optional path to f18 as 2nd3# Set: $FLANG_FC1 to the path to the Flang frontend driver with options; $temp4# to an empty temp directory; and $src to the full path of the single source5# argument.6 7function die {8 echo "$(basename $0): $*" >&29 exit 110}11if [[ $# < 3 ]]; then12 echo "Usage: $(basename $0) <fortran-source> <temp test dir> <f18-command>"13 exit 114fi15 16case $1 in17 (/*) src="$1" ;;18 (*) src="$(dirname $0)/$1" ;;19esac20shift21temp=$122mkdir -p $temp23shift24 25[[ ! -f $1 ]] && die "f18 executable not found: $1"26FLANG_FC1="$*"27