Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # TestRunner.sh - This script is used to run arbitrary unit tests. Unit |
| 4 | # tests must contain the command used to run them in the input file, starting |
| 5 | # immediately after a "RUN:" string. |
| 6 | # |
| 7 | # This runner recognizes and replaces the following strings in the command: |
| 8 | # %s - Replaced with the input name of the program |
| 9 | # |
| 10 | |
Chris Lattner | d24d4af | 2002-02-11 23:32:43 +0000 | [diff] [blame] | 11 | grep 'RUN:' $1 | sed "s/^.*RUN:\(.*\)$/\1/g;s/%s/$1/g" > Output/$1.script |
Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 12 | OUTPUT=Output/$1.out |
| 13 | |
Chris Lattner | d24d4af | 2002-02-11 23:32:43 +0000 | [diff] [blame] | 14 | |
| 15 | /bin/sh Output/$1.script > $OUTPUT 2>&1 || ( |
Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 16 | echo "******************** TEST '$1' FAILED! ********************" |
Chris Lattner | d24d4af | 2002-02-11 23:32:43 +0000 | [diff] [blame] | 17 | echo "Command: " |
| 18 | cat Output/$1.script |
Chris Lattner | 9a3c2b5 | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 19 | echo "Output:" |
| 20 | cat $OUTPUT |
| 21 | rm $OUTPUT |
| 22 | echo "******************** TEST '$1' FAILED! ********************" |
| 23 | ) |
| 24 | |