diff mbox series

[Testsuite] Have dg-cmp-results reject log files.

Message ID 20180123103125.GA20745@arm.com
State New
Headers show
Series [Testsuite] Have dg-cmp-results reject log files. | expand

Commit Message

Tamar Christina Jan. 23, 2018, 10:31 a.m. UTC
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.christina@arm.com>

	* dg-cmp-results.sh: Reject log files from comparison.

--

Comments

Bernhard Reutner-Fischer Jan. 23, 2018, 11:30 a.m. UTC | #1
On 23 January 2018 11:31:27 CET, Tamar Christina <tamar.christina@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

+    exit 1
+fi
 
>
>Ok for trunk?
>
>Thanks,
>Tamar
>
>contrib/
>2018-01-23  Tamar Christina  <tamar.christina@arm.com>
>
>	* dg-cmp-results.sh: Reject log files from comparison.
Tamar Christina Jan. 23, 2018, 11:52 a.m. UTC | #2
The 01/23/2018 11:30, Bernhard Reutner-Fischer wrote:
> On 23 January 2018 11:31:27 CET, Tamar Christina <tamar.christina@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.christina@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.
Mike Stump Jan. 23, 2018, 6:11 p.m. UTC | #3
On Jan 23, 2018, at 2:31 AM, Tamar Christina <Tamar.Christina@arm.com> wrote:
> 
> This patch makes dg-cmp-results.sh reject the use of log files in the comparison.

No please.  We like to run that script on log files from time to time for various reasons.  I'd rather fix anything that prevents that from working as expected.

> 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.

Add a make target if you can't type the right command line?
diff mbox series

Patch

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.