Respect TMPDIR in contrib scripts.

2018-02-18  Yury Gribov  <tetra2005@gmail.com>

contrib/
	* compare_tests: Use TMPDIR when set.
	* dg-cmp-results.sh: Ditto.
	* warn_summary: Ditto.

From-SVN: r257801
This commit is contained in:
Yury Gribov 2018-02-19 08:03:17 +00:00 committed by Yury Gribov
parent e2b7efbf27
commit 9f88a07b85
4 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2018-02-19 Yury Gribov <tetra2005@gmail.com>
* compare_tests: Use TMPDIR when set.
* dg-cmp-results.sh: Ditto.
* warn_summary: Ditto.
2018-01-29 Jonathan Wakely <jwakely@redhat.com>
* download_prerequisites: Use shasum for FreeBSD and DragonFly.

View File

@ -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

View File

@ -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

View File

@ -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