[llvm-commits] CVS: llvm/test/Programs/DiffOutput.sh

Brian Gaeke gaeke at cs.uiuc.edu
Thu Jan 8 15:38:02 PST 2004


Changes in directory llvm/test/Programs:

DiffOutput.sh updated: 1.13 -> 1.14

---
Log message:

Add more documentation.
Use better variable names.
Allow diffing against something other than the native compiler's output.


---
Diffs of the changes:  (+29 -11)

Index: llvm/test/Programs/DiffOutput.sh
diff -u llvm/test/Programs/DiffOutput.sh:1.13 llvm/test/Programs/DiffOutput.sh:1.14
--- llvm/test/Programs/DiffOutput.sh:1.13	Sat Nov  8 16:42:32 2003
+++ llvm/test/Programs/DiffOutput.sh	Thu Jan  8 15:37:19 2004
@@ -1,18 +1,36 @@
 #!/bin/sh
 #
-# Program:  DiffOutput.sh
+# NAME
+#     DiffOutput.sh
 #
-# Synopsis: Check two output files for program executions and make sure they
-#           match.
+# SYNOPSIS
+#     DiffOutput.sh <testtype> <testname> [<goodoutput>]
 #
-# Syntax:  ./DiffOutput [lli|llc] <testname>
+# DESCRIPTION
+#     DiffOutput.sh looks for a file named Output/<testname>.out-<testtype>
+#     and uses GNU diff to compare it against the file
+#     Output/<testname>.out-<goodoutput>.  This script is used to verify the
+#     results of programs run in the LLVM test suite. By default,
+#     <goodoutput> is "nat"; that is, test results are compared with output
+#     from the program compiled with the native compiler.
+#     If the files differ, DiffOutput.sh prints a portion of the
+#     differences.
+#
+# EXIT STATUS
+#     DiffOutput.sh always exits with a zero (successful) exit code.
 #
 
-# DIFFOUTPUT - The output filename to make
-DIFFOUTPUT=Output/$2.diff-$1
+# Command line parameters:
+WHICHOUTPUT=$1
+PROG=$2
+GOODOUTPUT=${3-nat}
+# Output filename:
+DIFFOUTPUT=Output/${PROG}.diff-${WHICHOUTPUT}
+# Input filenames:
+TESTOUTPUT=Output/${PROG}.out-${WHICHOUTPUT}
+GOODOUTPUT=Output/${PROG}.out-${GOODOUTPUT}
 
 # Find gnu diff
-
 DIFF=diff
 if which gdiff > /dev/null 2>&1
 then
@@ -24,11 +42,11 @@
 fi
 
 # Diff the two files.
-$DIFF -u Output/$2.out-nat Output/$2.out-$1 > $DIFFOUTPUT || (
+$DIFF -u $GOODOUTPUT $TESTOUTPUT > $DIFFOUTPUT || (
   # They are different!
-  echo "******************** TEST '$2' FAILED! ********************"
+  echo "******************** TEST '$PROG' FAILED! ********************"
   echo "Execution Context Diff:"
-  head -n 200 $DIFFOUTPUT
+  head -n 200 $DIFFOUTPUT | cat -v
   rm $DIFFOUTPUT
-  echo "******************** TEST '$2' FAILED! ********************"
+  echo "******************** TEST '$PROG' FAILED! ********************"
 )





More information about the llvm-commits mailing list