#!/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>.
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)
OBASE=`basename "$2"`
NFILE="$3"
NBASE=`basename "$3"`
+TMPDIR=${TMPDIR:-/tmp}
echo "dg-cmp-results.sh: Verbosity is ${verbose}, Variant is \"${VARIANT}\""
echo
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.
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
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