Add a trivial script to extract the times from *.report.txt files.
[llvm-testsuite.git] / DiffOutput.sh
blob8209926d39a68056331ebb20e2189b97364cf2f9
1 #!/bin/sh
3 # NAME
4 # DiffOutput.sh
6 # SYNOPSIS
7 # DiffOutput.sh <diff&opts> <testtype> <testname> [<goodoutput>]
9 # DESCRIPTION
10 # DiffOutput.sh looks for a file named Output/<testname>.out-<testtype>
11 # and uses GNU diff to compare it against the file
12 # Output/<testname>.out-<goodoutput>. This script is used to verify the
13 # results of programs run in the LLVM test suite. By default,
14 # <goodoutput> is "nat"; that is, test results are compared with output
15 # from the program compiled with the native compiler.
16 # If the files differ, DiffOutput.sh prints a portion of the
17 # differences.
19 # EXIT STATUS
20 # DiffOutput.sh always exits with a zero (successful) exit code.
23 # Command line parameters:
24 DIFF=$1
25 WHICHOUTPUT=$2
26 PROG=$3
27 GOODOUTPUT=${4-nat}
28 # Output filename:
29 DIFFOUTPUT=Output/${PROG}.diff-${WHICHOUTPUT}
30 # Input filenames:
31 TESTOUTPUT=Output/${PROG}.out-${WHICHOUTPUT}
32 GOODOUTPUT=Output/${PROG}.out-${GOODOUTPUT}
34 # Diff the two files.
35 $DIFF $GOODOUTPUT $TESTOUTPUT > $DIFFOUTPUT 2>&1 || (
36 # They are different!
37 echo "******************** TEST ($WHICHOUTPUT) '$PROG' FAILED! ********************"
38 echo "Execution Context Diff:"
39 head -n 200 $DIFFOUTPUT | cat -v
40 rm $DIFFOUTPUT
41 echo "******************** TEST ($WHICHOUTPUT) '$PROG' ****************************"