[flang] Clean up temp dirs

A temp directory is created in `common.sh` and it is cleaned up by
`trap ... EXIT`. If the test script has its own trap, as this one does,
it seems to replace the first one. So the cleanup from `common.sh` was
not being executed when the `%t` feature was used and empty temp
directories were being left in the directory where the tests ran.

Since we already have a temp directory that is cleaned up, just use
that for `%t` and don't bother with another `mktemp`.

Original-commit: flang-compiler/f18@f61d62ddec
Reviewed-on: https://github.com/flang-compiler/f18/pull/754
This commit is contained in:
Tim Keith 2019-09-18 13:17:48 -07:00
parent bb1127efb6
commit b506f39f18
1 changed files with 1 additions and 3 deletions

View File

@ -66,9 +66,7 @@ for input in ${srcdir}/$*; do
CMD=$(cat ${input} | egrep '^[[:space:]]*![[:space:]]*RUN:[[:space:]]*' | sed -e 's/^[[:space:]]*![[:space:]]*RUN:[[:space:]]*//')
CMD=$(echo ${CMD} | sed -e "s:%s:${input}:g")
if egrep -q -e '%t' <<< ${CMD} ; then
temp=`mktemp`
trap "rm -f ${temp}" EXIT
CMD=$(echo ${CMD} | sed -e "s:%t:${temp}:g")
CMD=$(echo ${CMD} | sed -e "s:%t:$temp/t:g")
fi
if $(eval $CMD); then
echo "PASS ${input}"