From 9f88a07b85a2922ab1d7ae8ec02b18aa739af32a Mon Sep 17 00:00:00 2001 From: Yury Gribov Date: Mon, 19 Feb 2018 08:03:17 +0000 Subject: [PATCH] Respect TMPDIR in contrib scripts. 2018-02-18 Yury Gribov contrib/ * compare_tests: Use TMPDIR when set. * dg-cmp-results.sh: Ditto. * warn_summary: Ditto. From-SVN: r257801 --- contrib/ChangeLog | 6 ++++++ contrib/compare_tests | 23 ++++++++++++----------- contrib/dg-cmp-results.sh | 9 +++++---- contrib/warn_summary | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index cf6e03e4e1d..627cafd75e4 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,9 @@ +2018-02-19 Yury Gribov + + * compare_tests: Use TMPDIR when set. + * dg-cmp-results.sh: Ditto. + * warn_summary: Ditto. + 2018-01-29 Jonathan Wakely * download_prerequisites: Use shasum for FreeBSD and DragonFly. diff --git a/contrib/compare_tests b/contrib/compare_tests index d16e7e9737e..51a3719ff6a 100755 --- a/contrib/compare_tests +++ b/contrib/compare_tests @@ -36,17 +36,18 @@ export LC_ALL=C tool=gxx -tmp1=/tmp/$tool-testing.$$a -tmp2=/tmp/$tool-testing.$$b -now_s=/tmp/$tool-testing.$$d -before_s=/tmp/$tool-testing.$$e -lst1=/tmp/$tool-lst1.$$ -lst2=/tmp/$tool-lst2.$$ -lst3=/tmp/$tool-lst3.$$ -lst4=/tmp/$tool-lst4.$$ -lst5=/tmp/$tool-lst5.$$ -sum1=/tmp/$tool-sum1.$$ -sum2=/tmp/$tool-sum2.$$ +TMPDIR=${TMPDIR:-/tmp} +tmp1=$TMPDIR/$tool-testing.$$a +tmp2=$TMPDIR/$tool-testing.$$b +now_s=$TMPDIR/$tool-testing.$$d +before_s=$TMPDIR/$tool-testing.$$e +lst1=$TMPDIR/$tool-lst1.$$ +lst2=$TMPDIR/$tool-lst2.$$ +lst3=$TMPDIR/$tool-lst3.$$ +lst4=$TMPDIR/$tool-lst4.$$ +lst5=$TMPDIR/$tool-lst5.$$ +sum1=$TMPDIR/$tool-sum1.$$ +sum2=$TMPDIR/$tool-sum2.$$ tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2" [ "$1" = "-strict" ] && strict=$1 && shift diff --git a/contrib/dg-cmp-results.sh b/contrib/dg-cmp-results.sh index 5f2fed5ec3f..821d557a168 100755 --- a/contrib/dg-cmp-results.sh +++ b/contrib/dg-cmp-results.sh @@ -63,6 +63,7 @@ OFILE="$2" OBASE=`basename "$2"` NFILE="$3" NBASE=`basename "$3"` +TMPDIR=${TMPDIR:-/tmp} echo "dg-cmp-results.sh: Verbosity is ${verbose}, Variant is \"${VARIANT}\"" echo @@ -97,7 +98,7 @@ sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \ -e 's/^/O:/' \ $OFILE | sort -s -t : -k 3b - \ - >/tmp/o$$-$OBASE + >$TMPDIR/o$$-$OBASE # Create a temporary file from the new file's interesting section. sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \ @@ -107,7 +108,7 @@ sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \ -e 's/^/N:/' \ $NFILE | sort -s -t : -k 3b - \ - >/tmp/n$$-$NBASE + >$TMPDIR/n$$-$NBASE # Merge the two files, then compare adjacent lines. # Comparison is complicated by tests that may be run multiple times. @@ -200,10 +201,10 @@ END { while (old = peek()) compare("", "") } EOF -sort -m -s -t : -k 3b /tmp/o$$-$OBASE /tmp/n$$-$NBASE | +sort -m -s -t : -k 3b $TMPDIR/o$$-$OBASE $TMPDIR/n$$-$NBASE | awk -v verbose=$verbose -f compare-$$.awk /dev/stdin # Delete the temporary files. -rm -f compare-$$.awk /tmp/o$$-$OBASE /tmp/n$$-$NBASE +rm -f compare-$$.awk $TMPDIR/o$$-$OBASE $TMPDIR/n$$-$NBASE exit 0 diff --git a/contrib/warn_summary b/contrib/warn_summary index ccdb33a1117..d4c8b6cdb19 100755 --- a/contrib/warn_summary +++ b/contrib/warn_summary @@ -138,7 +138,7 @@ s%^[^ ]*/\(lib[a-z23+-]*/\)%\1%;' usage="usage: `basename $0` [-llf] [-s stage] [-nosub|-ch|-cp|-f|-fortran|-ada|-intl|-fixinc] [-pass|-wpass] [file(s)]" stageN=3 -tmpfile=/tmp/tmp-warn.$$ +tmpfile=${TMPDIR:-/tmp}/tmp-warn.$$ # Remove $tmpfile on exit and various signals. trap "rm -f $tmpfile" 0 -- 2.30.2