Respect TMPDIR in contrib scripts.
authorYury Gribov <tetra2005@gmail.com>
Mon, 19 Feb 2018 08:03:17 +0000 (08:03 +0000)
committerYury Gribov <ygribov@gcc.gnu.org>
Mon, 19 Feb 2018 08:03:17 +0000 (08:03 +0000)
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

contrib/ChangeLog
contrib/compare_tests
contrib/dg-cmp-results.sh
contrib/warn_summary

index cf6e03e4e1dea4e1ae9f6866a35ed1b33968ff76..627cafd75e4cb8110975925ca88386ecceb41409 100644 (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.
index d16e7e9737e85e50d3b97b8cb12e28e24e489dc0..51a3719ff6a832778f6dafd5944dd172242cbc64 100755 (executable)
@@ -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
index 5f2fed5ec3ff0c66d22bc07c84571568730fbcac..821d557a168fe6b01d0149c81e258188856bd983 100755 (executable)
@@ -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
index ccdb33a1117f49c1f7d741704719880e763ef90f..d4c8b6cdb19805ba06cb5c2bb0979136619d586d 100755 (executable)
@@ -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