Hi All, This patch makes dg-cmp-results.sh reject the use of log files in the comparison. Often when given a log file dg-cmp-results will give incomplete/wrong output and using log instead of sum is one autocomplete tab away.
Instead have the tool guard against such mistakes. Ok for trunk? Thanks, Tamar contrib/ 2018-01-23 Tamar Christina <tamar.christ...@arm.com> * dg-cmp-results.sh: Reject log files from comparison. --
diff --git a/contrib/dg-cmp-results.sh b/contrib/dg-cmp-results.sh index 5f2fed5ec3ff0c66d22bc07c84571568730fbcac..93461efbeff7c7d3b6051ab978cf97122dd5079d 100755 --- a/contrib/dg-cmp-results.sh +++ b/contrib/dg-cmp-results.sh @@ -61,8 +61,20 @@ esac VARIANT="$1" OFILE="$2" OBASE=`basename "$2"` +OEXT="${OBASE##*.}" NFILE="$3" NBASE=`basename "$3"` +NEXT="${NBASE##*.}" + +if test "$OEXT" = "log"; then + echo "<old-file> must be a sum file instead of log file." + exit 1 +fi + +if test "$NEXT" = "log"; then + echo "<old-file> must be a sum file instead of log file." + exit 1 +fi echo "dg-cmp-results.sh: Verbosity is ${verbose}, Variant is \"${VARIANT}\"" echo @@ -82,11 +94,11 @@ fi unset temp # Copy out the old file's section 0. -echo "Older log file: $OFILE" +echo "Older summary file: $OFILE" sed $E -e '/^[[:space:]]+===/,$d' $OFILE # Copy out the new file's section 0. -echo "Newer log file: $NFILE" +echo "Newer summary file: $NFILE" sed $E -e '/^[[:space:]]+===/,$d' $NFILE # Create a temporary file from the old file's interesting section.