]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - contrib/dg-cmp-results.sh
2019-06-13 Richard Biener <rguenther@suse.de>
[thirdparty/gcc.git] / contrib / dg-cmp-results.sh
index f5a4f09a616be9bd66dc9788feeeaa85ada3e8ec..eb976f68f4ac6800fca67c48bb6b3466f6213604 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright (C) 2006 Free Software Foundation
+# Copyright (C) 2006, 2008 Free Software Foundation
 #
 # Analyze changes in GCC DejaGNU test logs for binutils, gcc, gdb, etc.
 # Original version written in 2005 by James Lemke <jwlemke@wasabisystems.com>.
@@ -27,11 +27,21 @@ while test "$1" = "-v"; do
     shift
 done
 
-if test $# -ne 3 -o ! -f "$2" -o ! -f "$3"; then
+if test $# -ne 3 ; then
     usage
     exit 1
 fi
 
+if test ! -f "$2"; then
+    echo "unable to open $2" >&2
+    exit 1
+fi
+
+if test ! -f "$3"; then
+    echo "unable to open $3" >&2
+    exit 1
+fi
+
 # Command differences for various platforms.
 case `uname -s` in
 Darwin|NetBSD)
@@ -53,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
@@ -80,26 +91,24 @@ echo "Newer log file: $NFILE"
 sed $E -e '/^[[:space:]]+===/,$d' $NFILE
 
 # Create a temporary file from the old file's interesting section.
-sed $E -e "1,/$header/d" \
-  -e '/^[[:space:]]+===/,$d' \
+sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
   -e '/^[A-Z]+:/!d' \
   -e '/^(WARNING|ERROR):/d' \
   -e 's/\r$//' \
   -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 "1,/$header/d" \
-  -e '/^[[:space:]]+===/,$d' \
+sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
   -e '/^[A-Z]+:/!d' \
   -e '/^(WARNING|ERROR):/d' \
   -e 's/\r$//' \
   -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.
@@ -128,14 +137,17 @@ function drop() {
 function compare(st, nm) {
     old = peek()
     if (old == 0) {
-        # This new test wasn't run last time.
-        if (verbose >= 2) printf("NA->%s:%s\n", st, nm)
+       # This new test wasn't run last time.
+       if(st == "FAIL" || st == "UNRESOLVED" || verbose >= 2) {
+           # New test fails or we want all changes
+           printf("NA->%s:%s\n", st, nm)
+       }
     }
     else {
        # Compare this new test to the first queued old one.
        if (verbose >= 4) {
            printf("Comparing two lines:\n O:%s:%s\n N:%s:%s\n",
-            status[old], nm[old], st, nm)
+            status[old], name[old], st, nm)
        }
         if (name[old] != nm) {
            # The old test wasn't run this time and
@@ -192,10 +204,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