The 01/23/2018 11:30, Bernhard Reutner-Fischer wrote: > On 23 January 2018 11:31:27 CET, Tamar Christina <tamar.christ...@arm.com> > wrote: > >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. > > +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." > > typo: new-file >
Thanks, Typo fixed. > + exit 1 > +fi > > > > >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..d1a7332660c35ca008d8e0d06eba8842758032c5 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 "<new-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.