| Chris Lattner | 0f342da | 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: |
| Chris Lattner | 9600e8d | 2003-05-14 18:39:57 +0000 | [diff] [blame] | 8 | # |
| 9 | # %s - Replaced with the input name of the program, or the program to |
| 10 | # execute, as appropriate. |
| Reid Spencer | 68e1b24 | 2006-11-02 03:37:39 +0000 | [diff] [blame] | 11 | # %llvmgcc - llvm-gcc command |
| 12 | # %llvmgxx - llvm-g++ command |
| 13 | # %prcontext - prcontext.tcl script |
| Chris Lattner | 0f342da | 2002-02-01 04:24:47 +0000 | [diff] [blame] | 14 | # |
| Reid Spencer | b9dbd5b | 2007-04-15 06:47:49 +0000 | [diff] [blame^] | 15 | TESTFILE=$1 |
| 16 | if test `dirname $TESTFILE` == . ; then |
| 17 | TESTPATH=`pwd` |
| 18 | SUBDIR="" |
| 19 | while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do |
| 20 | tmp=`basename $TESTPATH` |
| 21 | SUBDIR="$tmp/$SUBDIR" |
| 22 | TESTPATH=`dirname $TESTPATH` |
| 23 | done |
| 24 | if test -d "$TESTPATH" ; then |
| 25 | cd $TESTPATH |
| 26 | make check-one TESTONE="$SUBDIR$TESTFILE" |
| 27 | else |
| 28 | echo "Can't find llvm/test directory in " `pwd` |
| 29 | fi |
| 30 | else |
| 31 | make check-one TESTONE=$TESTFILE |
| 32 | fi |