comparison contrib/dg-cmp-results.sh @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
61 VARIANT="$1" 61 VARIANT="$1"
62 OFILE="$2" 62 OFILE="$2"
63 OBASE=`basename "$2"` 63 OBASE=`basename "$2"`
64 NFILE="$3" 64 NFILE="$3"
65 NBASE=`basename "$3"` 65 NBASE=`basename "$3"`
66 TMPDIR=${TMPDIR:-/tmp}
66 67
67 echo "dg-cmp-results.sh: Verbosity is ${verbose}, Variant is \"${VARIANT}\"" 68 echo "dg-cmp-results.sh: Verbosity is ${verbose}, Variant is \"${VARIANT}\""
68 echo 69 echo
69 70
70 header="^Running target $VARIANT" 71 header="^Running target $VARIANT"
95 -e '/^(WARNING|ERROR):/d' \ 96 -e '/^(WARNING|ERROR):/d' \
96 -e 's/\r$//' \ 97 -e 's/\r$//' \
97 -e 's/^/O:/' \ 98 -e 's/^/O:/' \
98 $OFILE | 99 $OFILE |
99 sort -s -t : -k 3b - \ 100 sort -s -t : -k 3b - \
100 >/tmp/o$$-$OBASE 101 >$TMPDIR/o$$-$OBASE
101 102
102 # Create a temporary file from the new file's interesting section. 103 # Create a temporary file from the new file's interesting section.
103 sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \ 104 sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
104 -e '/^[A-Z]+:/!d' \ 105 -e '/^[A-Z]+:/!d' \
105 -e '/^(WARNING|ERROR):/d' \ 106 -e '/^(WARNING|ERROR):/d' \
106 -e 's/\r$//' \ 107 -e 's/\r$//' \
107 -e 's/^/N:/' \ 108 -e 's/^/N:/' \
108 $NFILE | 109 $NFILE |
109 sort -s -t : -k 3b - \ 110 sort -s -t : -k 3b - \
110 >/tmp/n$$-$NBASE 111 >$TMPDIR/n$$-$NBASE
111 112
112 # Merge the two files, then compare adjacent lines. 113 # Merge the two files, then compare adjacent lines.
113 # Comparison is complicated by tests that may be run multiple times. 114 # Comparison is complicated by tests that may be run multiple times.
114 # If that case, we assume that the order is the same in both files. 115 # If that case, we assume that the order is the same in both files.
115 cat <<EOF >compare-$$.awk 116 cat <<EOF >compare-$$.awk
198 199
199 END { 200 END {
200 while (old = peek()) compare("", "") 201 while (old = peek()) compare("", "")
201 } 202 }
202 EOF 203 EOF
203 sort -m -s -t : -k 3b /tmp/o$$-$OBASE /tmp/n$$-$NBASE | 204 sort -m -s -t : -k 3b $TMPDIR/o$$-$OBASE $TMPDIR/n$$-$NBASE |
204 awk -v verbose=$verbose -f compare-$$.awk /dev/stdin 205 awk -v verbose=$verbose -f compare-$$.awk /dev/stdin
205 206
206 # Delete the temporary files. 207 # Delete the temporary files.
207 rm -f compare-$$.awk /tmp/o$$-$OBASE /tmp/n$$-$NBASE 208 rm -f compare-$$.awk $TMPDIR/o$$-$OBASE $TMPDIR/n$$-$NBASE
208 209
209 exit 0 210 exit 0